From cdd4434fefc77c584df370ea7f4953fc0e98066b Mon Sep 17 00:00:00 2001 From: Peter Munch-Ellingsen Date: Thu, 22 Feb 2024 00:28:37 +0200 Subject: [PATCH 1/2] Fix background color not resetting (#225) --- src/nimdowpkg/statusbar.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nimdowpkg/statusbar.nim b/src/nimdowpkg/statusbar.nim index acf33da..0f37e40 100644 --- a/src/nimdowpkg/statusbar.nim +++ b/src/nimdowpkg/statusbar.nim @@ -513,6 +513,7 @@ proc renderStringRightAligned( while i < sgr.len: if sgr[i] == resetCode: color = -1 + bgColor = -1 selectedFont = -1 fontErrorLogged = false elif sgr[i] >= fontStart and sgr[i] <= fontStop: From 9691c6992d94cf00c6a6fc3ceca7e8cf6a7583c1 Mon Sep 17 00:00:00 2001 From: Peter Munch-Ellingsen Date: Thu, 22 Feb 2024 00:29:47 +0200 Subject: [PATCH 2/2] Add clicked button as script argument for statusbar (#226) * Fix background color not resetting * Add button identifier to script calling --- config.default.toml | 2 +- src/nimdowpkg/config/configloader.nim | 7 ++++--- src/nimdowpkg/windowmanager.nim | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config.default.toml b/config.default.toml index f1677f1..1ac2e52 100644 --- a/config.default.toml +++ b/config.default.toml @@ -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] diff --git a/src/nimdowpkg/config/configloader.nim b/src/nimdowpkg/config/configloader.nim index 6da34cd..0c66d00 100644 --- a/src/nimdowpkg/config/configloader.nim +++ b/src/nimdowpkg/config/configloader.nim @@ -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 @@ -308,7 +308,7 @@ 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, @@ -316,7 +316,8 @@ proc populateExternalProcessSettings(this: Config, configTable: TomlTable, displ $regionCord.y, $clickCord.x, $clickCord.y, - $width + $width, + $button ) else: this.configureExternalProcess(command) diff --git a/src/nimdowpkg/windowmanager.nim b/src/nimdowpkg/windowmanager.nim index cd7b9c0..e8128d0 100644 --- a/src/nimdowpkg/windowmanager.nim +++ b/src/nimdowpkg/windowmanager.nim @@ -1823,7 +1823,8 @@ proc handleButtonPressed(this: WindowManager, e: XButtonEvent) = clickedInfo.index, clickedInfo.width, clickedInfo.regionCord, - clickedInfo.clickCord + clickedInfo.clickCord, + e.button.int ) return