From 87589048a3d52d93103cc60585a154710ff2961a Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 14 May 2023 17:28:54 +0200 Subject: BSPWM: update desktop script --- bspwm/scripts/bspwm/desktops.sh | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'bspwm/scripts') 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 ;; -- cgit v1.2.3