aboutsummaryrefslogtreecommitdiff
path: root/bspwm/scripts
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2023-05-14 17:28:54 +0200
committerSébastien Dailly <sebastien@dailly.me>2023-05-14 17:28:54 +0200
commit87589048a3d52d93103cc60585a154710ff2961a (patch)
tree65f923ea6e6ad8f1deb3a0e572f5cd0be21d5204 /bspwm/scripts
parent369ba2d960a16289317efd1ecc0bd7b04bd50b3e (diff)
BSPWM: update desktop script
Diffstat (limited to 'bspwm/scripts')
-rwxr-xr-xbspwm/scripts/bspwm/desktops.sh34
1 files changed, 22 insertions, 12 deletions
diff --git a/bspwm/scripts/bspwm/desktops.sh b/bspwm/scripts/bspwm/desktops.sh
index a217439..27b285f 100755
--- a/bspwm/scripts/bspwm/desktops.sh
+++ b/bspwm/scripts/bspwm/desktops.sh
@@ -1,4 +1,19 @@
#!/bin/sh
+
+# Execute an application when creating the desktop
+#
+run_desktop() {
+ name=$1
+ application=$2
+ window_name=$3
+ bspc node @$name:/ -i
+ gspc rule --add $window_name --one-shot node=@$name:/
+ $application &
+}
+
+
+# This script is designed to be used with sxhkd/rofi_new.sh which populate the
+# rof menu with the values.
bspc subscribe desktop | while read -r event monitor_id desktop_id name; do
case $event in
desktop_focus)
@@ -15,24 +30,19 @@ bspc subscribe desktop | while read -r event monitor_id desktop_id name; do
bspc monitor -o $(bspc query --names -D | sort -V | tr -s '\n' ' ')
case $name in
Chat)
- bspc node @$name:/ -i
- bspc rule --add Signal --one-shot node=@$name:/
- signal-desktop &
+ run_desktop $name signal-desktop Signal
;;
Musique)
- bspc node @$name:/ -i
- bspc rule --add Gmpc --one-shot node=@$name:/
- gmpc &
+ run_desktop $name gmpc Gmpc
;;
Web)
- bspc node @$name:/ -i
- bspc rule --add firefox-esr --one-shot node=@$name:/
- firefox-esr &
+ run_desktop $name firefox-esr firefox-esr
;;
Mail)
- bspc node @$name:/ -i
- bspc rule --add thunderbird --one-shot node=@$name:/
- thunderbird &
+ run_desktop $name thunderbird thunderbird
+ ;;
+ Discord)
+ run_desktop $name discord discord
;;
esac
;;