From c17504809a955528098d695297368ecaf41183a2 Mon Sep 17 00:00:00 2001 From: Sravan Balaji Date: Tue, 29 Apr 2025 21:43:50 -0400 Subject: [PATCH] Add waybar toggle script and keybinding --- README.org | 13 +++++++++++++ hyprland.conf | 2 ++ waybar/scripts/toggleBarService.sh | 6 ++++++ 3 files changed, 21 insertions(+) create mode 100755 waybar/scripts/toggleBarService.sh diff --git a/README.org b/README.org index 4b99d51..c0f3abc 100644 --- a/README.org +++ b/README.org @@ -78,6 +78,7 @@ - [[#system76-power][System76 Power]] - [[#tray][Tray]] - [[#end-configuration][End Configuration]] + - [[#toggle-script][Toggle Script]] * Welcome @@ -115,6 +116,7 @@ $terminal = foot $fileManager = thunar $menu = rofi -show combi -run-command "uwsm app -- {cmd}" $colorPicker = hyprpicker -a +$toggleBar = $HOME/.config/hypr/waybar/scripts/toggleBarService.sh #+END_SRC ** Autostart @@ -472,6 +474,7 @@ bind = $mainMod SHIFT, Return, exec, uwsm app -- $terminal bind = $mainMod, E, exec, uwsm app -- $fileManager bind = $mainMod, P, exec, uwsm app -- $menu bind = $mainMod, G, exec, uwsm app -- $colorPicker +bind = $mainMod, B, exec, uwsm app -- $toggleBar bind = $mainMod CTRL, P, exec, uwsm app -- $HOME/.scripts/control-center.sh --rofi bind = $mainMod CTRL, C, exec, uwsm app -- cliphist list | rofi -dmenu | cliphist decode | wl-copy bind = $mainMod CTRL, D, exec, uwsm app -- $HOME/.scripts/brightness.sh --rofi @@ -1604,3 +1607,13 @@ echo '{"text":"󰢮 '$graphics'","tooltip":"󰢮\t'$graphics'\r󰐥\t'$graphicsP #+BEGIN_SRC jsonc :tangle waybar/config.jsonc } #+END_SRC + +** Toggle Script + +#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle waybar/scripts/toggleBarService.sh +if systemctl --user is-active waybar.service; then + systemctl --user stop waybar.service +else + systemctl --user start waybar.service +fi +#+END_SRC diff --git a/hyprland.conf b/hyprland.conf index 1a2e82c..877789d 100644 --- a/hyprland.conf +++ b/hyprland.conf @@ -4,6 +4,7 @@ $terminal = foot $fileManager = thunar $menu = rofi -show combi -run-command "uwsm app -- {cmd}" $colorPicker = hyprpicker -a +$toggleBar = $HOME/.config/hypr/waybar/scripts/toggleBarService.sh exec-once = uwsm app -- fumon & exec-once = uwsm app -- kdeconnectd --replace & @@ -182,6 +183,7 @@ bind = $mainMod SHIFT, Return, exec, uwsm app -- $terminal bind = $mainMod, E, exec, uwsm app -- $fileManager bind = $mainMod, P, exec, uwsm app -- $menu bind = $mainMod, G, exec, uwsm app -- $colorPicker +bind = $mainMod, B, exec, uwsm app -- $toggleBar bind = $mainMod CTRL, P, exec, uwsm app -- $HOME/.scripts/control-center.sh --rofi bind = $mainMod CTRL, C, exec, uwsm app -- cliphist list | rofi -dmenu | cliphist decode | wl-copy bind = $mainMod CTRL, D, exec, uwsm app -- $HOME/.scripts/brightness.sh --rofi diff --git a/waybar/scripts/toggleBarService.sh b/waybar/scripts/toggleBarService.sh new file mode 100755 index 0000000..b7571e7 --- /dev/null +++ b/waybar/scripts/toggleBarService.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +if systemctl --user is-active waybar.service; then + systemctl --user stop waybar.service +else + systemctl --user start waybar.service +fi