Make bitbar chunkwm script a bit less fragile

This commit is contained in:
Adam Goldsmith 2019-05-27 10:22:40 -04:00
parent 98be7e5531
commit a7b26b45ab

View File

@ -10,12 +10,21 @@ current_desktop=$(chunkc tiling::query --desktop id)
last_desktop=$(chunkc get _last_active_desktop) last_desktop=$(chunkc get _last_active_desktop)
monitor=$(chunkc tiling::query --monitor-for-desktop $current_desktop) monitor=$(chunkc tiling::query --monitor-for-desktop $current_desktop)
desktops=$(chunkc tiling::query --desktops-for-monitor $monitor) desktops=$(chunkc tiling::query --desktops-for-monitor $monitor)
highlighed=$(awk '{ highlighted=""
gsub("'${current_desktop}'", "'${TEAL}${current_desktop}${NC}'"); for desktop in $desktops
gsub("'${last_desktop}'", "'${RED}${last_desktop}${NC}'"); do
print; }' <<< $desktops) if (( $desktop == $current_desktop ))
then
highlighted+=" ${TEAL}$desktop${NC}"
elif (( $desktop == $last_desktop ))
then
highlighted+=" ${RED}$desktop${NC}"
else
highlighted+=" $desktop"
fi
done
echo ${highlighed} echo -e ${highlighted}
echo "---" echo "---"
for i in ~/.chunkwm_layouts/* for i in ~/.chunkwm_layouts/*
do do