Skip to content

Instantly share code, notes, and snippets.

@SidharthArya
Last active June 18, 2020 04:42
Show Gist options
  • Save SidharthArya/0a934fa45e8fe3c2a5cdd0a3e32ee25a to your computer and use it in GitHub Desktop.
Save SidharthArya/0a934fa45e8fe3c2a5cdd0a3e32ee25a to your computer and use it in GitHub Desktop.
Xmonad like Monitor for Bspwm
#!/bin/sh
MONITORS="$(bspc query -M --names)"
ARG1="$1"
FOCUSED_MONITOR="$(bspc query --names -M -m focused)"
for monitr in $MONITORS
do
FOCUSED="$(bspc query --names -D -d $monitr:focused)"
if [[ "$FOCUSED" == "$ARG1" ]];
then
MONITOR="$monitr"
fi
done
if [[ "$MONITOR" == "" ]];
then
bspc desktop "$ARG1" -m focused
bspc desktop "$ARG1" -f
else
FOCUSED_DESKTOP="$(bspc query --names -D -d focused)"
bspc desktop "$FOCUSED_DESKTOP" -m "$MONITOR"
bspc desktop "$ARG1" -m "$FOCUSED_MONITOR"
bspc desktop "$FOCUSED_DESKTOP" -f
bspc desktop "$ARG1" -f
fi
super + {1-9,0}
~/.config/sxhkd/scripts/desktop.sh {1-9,0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment