aboutsummaryrefslogtreecommitdiff
path: root/bspwm/scripts
diff options
context:
space:
mode:
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
;;