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
1 changed files with 14 additions and 5 deletions

View File

@ -10,12 +10,21 @@ current_desktop=$(chunkc tiling::query --desktop id)
last_desktop=$(chunkc get _last_active_desktop)
monitor=$(chunkc tiling::query --monitor-for-desktop $current_desktop)
desktops=$(chunkc tiling::query --desktops-for-monitor $monitor)
highlighed=$(awk '{
gsub("'${current_desktop}'", "'${TEAL}${current_desktop}${NC}'");
gsub("'${last_desktop}'", "'${RED}${last_desktop}${NC}'");
print; }' <<< $desktops)
highlighted=""
for desktop in $desktops
do
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 "---"
for i in ~/.chunkwm_layouts/*
do