diff options
Diffstat (limited to 'herbstluftwm/.local/bin')
| -rwxr-xr-x | herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh b/herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh index b7cf5e6..52ca9e4 100755 --- a/herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh +++ b/herbstluftwm/.local/bin/statusbar/polybar_hlwm_workspaces.sh @@ -14,15 +14,16 @@ hlwm_id() { done <<< "$(monitor_bound "$1")" } +echo "${MONITOR:?"Polybar should set the MONITOR variable"}" + this_monitor=$(polybar -m | grep "$MONITOR") monitor=$(hlwm_id "$this_monitor") get_layout() { - currenttag=$(hc tag_status | tr '\t' '\n' | sed -n 's/#//p') - focusedtaglayout=$(hc layout "$currenttag" @ | awk '{print $2}' | sed 's/://') - case "$focusedtaglayout" in + current_layout=$(hc get_attr tags.focus.tiling.focused_frame.algorithm) + case "$current_layout" in vertical) echo "V" ;; horizontal) @@ -36,7 +37,7 @@ get_layout() { layout=$(get_layout) -herbstclient --idle "(tag_*|focus_changed|window_title_changed)" 2>/dev/null | { +herbstclient --idle "(tag_*|(focus|window_title|attribute)_changed)" 2>/dev/null | { while true; do # Read tags into $tags array @@ -45,6 +46,8 @@ herbstclient --idle "(tag_*|focus_changed|window_title_changed)" 2>/dev/null | { # Read the prefix from each tag for i in "${tags[@]}" ; do case ${i:1} in + 'fl') + ;& 'hidden') ;& 'scratchpad') @@ -81,7 +84,7 @@ herbstclient --idle "(tag_*|focus_changed|window_title_changed)" 2>/dev/null | { ;; esac - echo "%{A1:herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}" + echo "%{A1:herbstclient and . focus_monitor $monitor . use ${i:1}:} ${i:1} %{A -u -o F- B-}" done echo "%{F-}%{B-}" @@ -91,10 +94,23 @@ herbstclient --idle "(tag_*|focus_changed|window_title_changed)" 2>/dev/null | { } | tr -d "\n" echo IFS=$'\t' read -ra cmd || break - case "${cmd[0]}" in - focus_changed|window_title_changed|layout_changed) - layout=$(get_layout) + #focus_changed|window_title_changed) + # layout=$(get_layout) ;; + attribute_changed) + if [[ "${cmd[1]}" == "tags.focus.tiling.focused_frame.algorithm" ]]; then + case "${cmd[3]}" in + vertical) + layout="V" ;; + horizontal) + layout="H" ;; + max) + layout="M" ;; + grid) + layout="G" ;; + esac + #layout="${cmd[3]}" + fi esac # wait for next event from herbstclient --idle # read -r || break |
