Skip to content

Commit

Permalink
Add clicked button as script argument for statusbar (#226)
Browse files Browse the repository at this point in the history
* Fix background color not resetting

* Add button identifier to script calling
  • Loading branch information
PMunch authored Feb 21, 2024
1 parent cdd4434 commit 9691c69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config.default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ modifiers = [ "super" ]

# Example: Start process when region is clicked, see github wiki for what constitutes a region
# [[startProcess]]
# command = "notify-send \"Id: %1, rx: %2, cx: %4, w: %6\""
# command = "notify-send \"Id: %1, rx: %2, cx: %4, cy: %5, w: %6, b: %7\""
# clickRegion = 0

[autostart]
Expand Down
7 changes: 4 additions & 3 deletions src/nimdowpkg/config/configloader.nim
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ proc findConfigPath*(): string =
type
KeyCombo* = tuple[keycode: int, modifiers: int]
Action* = proc(keyCombo: KeyCombo): void
RegionClickAction* = proc(idx: int, width: int, regionCord: Point[int], clickCord: Point[int]): void
RegionClickAction* = proc(idx: int, width: int, regionCord: Point[int], clickCord: Point[int], button: int): void

WindowSettings* = object
tagCount*: uint
Expand Down Expand Up @@ -308,15 +308,16 @@ proc populateExternalProcessSettings(this: Config, configTable: TomlTable, displ
closureScope:
let command = command
this.regionClickActionTable[clickRegion] =
proc(idx: int, width: int, regionCord: Point[int], clickCord: Point[int]) =
proc(idx: int, width: int, regionCord: Point[int], clickCord: Point[int], button: int) =
this.runCommandWithArgs(
command,
$idx,
$regionCord.x,
$regionCord.y,
$clickCord.x,
$clickCord.y,
$width
$width,
$button
)
else:
this.configureExternalProcess(command)
Expand Down
3 changes: 2 additions & 1 deletion src/nimdowpkg/windowmanager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,8 @@ proc handleButtonPressed(this: WindowManager, e: XButtonEvent) =
clickedInfo.index,
clickedInfo.width,
clickedInfo.regionCord,
clickedInfo.clickCord
clickedInfo.clickCord,
e.button.int
)
return

Expand Down

0 comments on commit 9691c69

Please sign in to comment.