Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ You can generate a new config at `$HOME/.config/boomer/config` with `$ boomer --

Supported parameters:

| Name | Description |
|----------------|----------------------------------------------------|
| min_scale | The smallest it can get when zooming out |
| scroll_speed | How quickly you can zoom in/out by scrolling |
| drag_friction | How quickly the movement slows down after dragging |
| scale_friction | How quickly the zoom slows down after scrolling |
| Name | Description |
|------------------|----------------------------------------------------|
| min_scale | The smallest it can get when zooming out |
| scroll_speed | How quickly you can zoom in/out by scrolling |
| drag_friction | How quickly the movement slows down after dragging |
| scale_friction | How quickly the zoom slows down after scrolling |
| invert_fl_scroll | Reverses the scroll directions for the flashlight |

## Experimental Features Compilation Flags

Expand Down
4 changes: 2 additions & 2 deletions src/boomer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -450,14 +450,14 @@ proc main() =

proc scrollUp() =
if (xev.xkey.state and ControlMask) > 0.uint32 and flashlight.isEnabled:
flashlight.deltaRadius += INITIAL_FL_DELTA_RADIUS
flashlight.deltaRadius += INITIAL_FL_DELTA_RADIUS * (if config.invert_fl_scroll: -1.0 else: 1.0)
else:
camera.deltaScale += config.scrollSpeed
camera.scalePivot = mouse.curr

proc scrollDown() =
if (xev.xkey.state and ControlMask) > 0.uint32 and flashlight.isEnabled:
flashlight.deltaRadius -= INITIAL_FL_DELTA_RADIUS
flashlight.deltaRadius -= INITIAL_FL_DELTA_RADIUS * (if config.invert_fl_scroll: -1.0 else: 1.0)
else:
camera.deltaScale -= config.scrollSpeed
camera.scalePivot = mouse.curr
Expand Down
5 changes: 5 additions & 0 deletions src/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ type Config* = object
scroll_speed*: float
drag_friction*: float
scale_friction*: float
invert_fl_scroll*: bool

const defaultConfig* = Config(
min_scale: 0.01,
scroll_speed: 1.5,
drag_friction: 6.0,
scale_friction: 4.0,
invert_fl_scroll: false,
)

proc loadConfig*(filePath: string): Config =
Expand All @@ -31,6 +33,8 @@ proc loadConfig*(filePath: string): Config =
result.drag_friction = parseFloat(value)
of "scale_friction":
result.scale_friction = parseFloat(value)
of "invert_fl_scroll":
result.invert_fl_scroll = parseBool(value)
else:
quit "Unknown config key `$#`" % [key]

Expand All @@ -41,3 +45,4 @@ proc generateDefaultConfig*(filePath: string) =
f.write("scroll_speed = ", defaultConfig.scroll_speed, "\n")
f.write("drag_friction = ", defaultConfig.drag_friction, "\n")
f.write("scale_friction = ", defaultConfig.scale_friction, "\n")
f.write("invert_fl_scroll = ", defaultConfig.invert_fl_scroll, "\n")