This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/wm/extras/bar/modules/bspwm-bm.bash

56 lines
1.3 KiB
Bash
Raw Normal View History

2016-01-12 15:02:12 -06:00
#!/usr/bin/env bash
source "$DOTFILES_PATH/variables.bash"
source "$DOTFILES_PATH/wm/extras/bar/colors.bash"
PRIORITY=2500
MATCH_PREFIX="W"
MATCH="$MATCH_PREFIX*"
ul="u"
if [ $BAR_UNDERLINE -eq 1 ]; then
:
else
ul="o"
fi
bar_module_bspwm() {
content="%{F$COLOR_FOREGROUND}%{c}"
line=$1
IFS=':'
set -- ${line#?}
while [ $# -gt 0 ] ; do
item=$1
name=${item#?}
cname="$name"
case $item in
2016-01-12 15:03:13 -06:00
O*) # focused occupied desktop
2016-01-12 15:02:12 -06:00
content="${content} %{F$COLOR_HIGHLIGHT}%{U$COLOR_HIGHLIGHT}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}"
;;
2016-01-12 15:03:13 -06:00
F*) # focused free desktop
2016-01-12 15:02:12 -06:00
content="${content} %{F$COLOR_DARK}%{U$COLOR_DARK}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}"
;;
2016-01-12 15:03:13 -06:00
U*) # focused occupied desktop
2016-01-12 15:02:12 -06:00
content="${content} %{F$COLOR_URGENT}%{U$COLOR_URGENT}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}"
;;
2016-01-12 15:03:13 -06:00
o*) # occupied desktop
2016-01-12 15:02:12 -06:00
content="${content} %{F$COLOR_FOREGROUND}${cname}%{F-}"
;;
2016-01-12 15:03:13 -06:00
f*) # free desktop
2016-01-12 15:02:12 -06:00
content="${content} %{F$COLOR_DARK}${cname}%{F-}"
;;
2016-01-12 15:03:13 -06:00
u*) # urgent desktop
2016-01-12 15:02:12 -06:00
content="${content} %{F$COLOR_URGENT}${cname}%{F-}"
;;
esac
shift
done
2016-01-12 15:03:13 -06:00
echo -e "$content"
2016-01-12 15:02:12 -06:00
}
export -f bar_module_bspwm
register_bar_module "$PRIORITY" "$MATCH" "bar_module_bspwm"
bspc subscribe all > "$BAR_FIFO" &