dotfiles/.config/BitBar/Enabled/yabai_enhanced.365d.sh

144 lines
21 KiB
Bash
Raw Normal View History

2021-01-12 23:25:28 +01:00
#!/bin/sh
# <bitbar.title>yabai enhanced</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>CHristian Baer</bitbar.author>
# <bitbar.author.github>chrisb86</bitbar.author.github>
# <bitbar.desc>Bitbar plugin to display yabai space ID and and mode with custom icon themes and dark mode support. </bitbar.desc>
# <bitbar.image>https://raw.githubusercontent.com/chrisb86/bitbar_yabai_enhanced/main/screenshot.png</bitbar.image>
# <bitbar.dependencies>sh, yabai</bitbar.dependencies>
# <bitbar.abouturl>https://github.com/chrisb86/</bitbar.abouturl>
## Set theme
theme="default"
## Set PATH
PATH="/opt/homebrew/bin:${PATH}"
## Set yabai path
yabai="yabai"
case $1 in
restart)
launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"
;;
stop)
brew services stop yabai
;;
esac
basedir=$(dirname "$0")
icon_path="${basedir}/yabai_enhanced/${theme}"
yabai_modes="float bsp stack"
yabai_spaces=$(yabai -m query --spaces | jq length)
yabai_displays=$(yabai -m query --displays | jq length)
space_id=$(yabai -m query --spaces --display | jq 'map(select(."focused" == 1))[-1].index')
space_mode=$(yabai -m query --spaces --display | jq -r 'map(select(."focused" == 1))[-1].type')
## Check if dark mode is active in macOS
macos_darkmode=$(defaults read -g AppleInterfaceStyle 2>/dev/null)
enc_icon() {
base64 -i $1 -o -
}
if [ "${theme}" == "default" ]; then
## Load light or dark icons
if [ "${macos_darkmode}" == "Dark" ]; then
icon_float="iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAFV2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENv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IjHhc2GXJhcUvjf1aIXfTE5W+MdkLRzyg7VT2Jms42gdKyktIywvpz+TzivV+5gvccSzC/MS+8R70QkRwIeTGabwM8oI4zKPMoSHYVnRIN9dzp9lXXIVmVUKaKyRJEUOl6h5qR6XmBA9LiNNwez/377qCa+nUt3hg+YXw/gYgJYdKBUN4/vYMEonYHuGq2wtf/0Ixj5FL9a0/kPo2IKL65oW3YPLbeh5UiNapCzZxK2JBLyfQfsSdN2CfaXSs+o+p48Q3pSvuoH9AxiU8x2rv0tEZ9l/1uq6AAAACXBIWXMAABYlAAAWJQFJUiTwAAABOUlEQVRYhe2Y20oDMRBAT0LftD4X/QtbF/pq/7FeP8X6LNh+gtWCrR+x4vowG8im2ZZizaTQAwPLbBbO5jKQMcQpgBEwAPrAecu4XVkB0zomwOu2D06BO6BKED/AGDhpk7kC3hPJ+PEGXIYyXeBDQcaXaszUvaKMi7GTGWYg4/ZUYZHTlAMGGFnkaOdC3wCfwIW2Sc3CIGtntE1qSqttEGA6wBcyQ7EgQb5ptJf/+jsbJY/4GKBHvHLyj/mNQprHPhQtO0oijrWNnFsdyk/Ibeq2dxq5I4eFAZasr2WseKXIldqFMeQ7t2NfWeR6mwsrC8y0LTxmFrn458LUAk/aFh4T9/CI/s31xjc7AxaKMnOkFdSgQKcDMkeaYlG6wENCmdtwZtoq9BC4Ru79A/bT0qtotvSegZdw0C+bhla1WySLHAAAAABJRU5ErkJggg=="
fi
else
# Check if theme directory exists
if [ -d "${icon_path}" ]; then
## Load light or dark icons
if [ "${macos_darkmode}" == "Dark" ]; then
icon_float=$(enc_icon ${icon_path}/float_dark.png)
icon_bsp=$(enc_icon ${icon_path}/bsp_dark.png)
icon_stack=$(enc_icon ${icon_path}/stack_dark.png)
else
icon_float=$(enc_icon ${icon_path}/float_light.png)
icon_bsp=$(enc_icon ${icon_path}/bsp_light.png)
icon_stack=$(enc_icon ${icon_path}/stack_light.png)
fi
else
echo "Theme directory ${icon_path} not found." && exit 1
fi
fi
## Output base64 icons
icon() {
case $1 in
float)
echo ${icon_float}
;;
bsp)
echo ${icon_bsp}
;;
stack)
echo ${icon_stack}
;;
esac
}
####
#### Output below
####
## Menubar
echo "${space_id}|templateImage=$(icon ${space_mode})"
## Dropdown menu
echo "---"
## Modes
echo "Select mode for current space"
for mode in ${yabai_modes}; do
if [[ ${space_mode} = ${mode} ]]; then
echo "${mode} | image=$(icon ${mode})"
else
echo "${mode} | image=$(icon ${mode}) terminal=false bash=yabai param1=-m param2=space param3=--layout param4=${mode}"
fi
done
echo "---"
## Spaces
echo "Spaces"
d=0; while [ ${d} -ne ${yabai_displays} ]; do
d=$((d+1))
display_spaces=$(yabai -m query --spaces --display $d | jq '.[].index')
if ! [ ${yabai_displays} == 1 ]; then
echo "Display $d"
fi
for s in ${display_spaces}; do
space_label=$(yabai -m query --spaces --space $s --display $d | jq -r '.label')
space_label="${space_label:-Unnamed}"
if [[ ${s} = ${space_id} ]]; then
echo "--$s: ${space_label} | image=$(icon $(yabai -m query --spaces --space $s --display | jq -r '.type')) checked=true"
else
echo "--$s: ${space_label} | image=$(icon $(yabai -m query --spaces --space $s --display | jq -r '.type')) terminal=false bash=yabai param1=-m param2=space param3=--focus param4=$s"
fi
done
done
echo "---"
## Services
echo "Services"
echo "--Restart yabai | bash='$0' param1=restart terminal=false"
echo "--Stop yabai | bash='$0' param1=stop terminal=false"