From a7b26b45ab4304c258c490387b2e286dd2a2a635 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 27 May 2019 10:22:40 -0400 Subject: [PATCH] Make bitbar chunkwm script a bit less fragile --- .config/bitbar/chunkwm-ws.1s.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.config/bitbar/chunkwm-ws.1s.sh b/.config/bitbar/chunkwm-ws.1s.sh index ec72cd9..e5477a3 100755 --- a/.config/bitbar/chunkwm-ws.1s.sh +++ b/.config/bitbar/chunkwm-ws.1s.sh @@ -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