diff --git a/.config/i3/multi-monitor-workspaces.sh b/.config/i3/multi-monitor-workspaces.sh index c45f903..b4cedb8 100755 --- a/.config/i3/multi-monitor-workspaces.sh +++ b/.config/i3/multi-monitor-workspaces.sh @@ -25,25 +25,12 @@ done shift $((OPTIND - 1)) [ $# -gt 0 ] || usage -outputs="$(i3-msg -t get_outputs | jq -r '.[] | select(.active).name')" -num_outs="$(printf "%s\n" "$outputs" | wc -l)" +name="$(i3-msg -t get_tree \ + | jq -r '.. | objects | select(.focused).output')" -if [ "$num_outs" -lt 2 ]; then - # only one monitor - workspace="$1" -else - name="$(i3-msg -t get_tree \ - | jq -r '.. | objects | select(.focused).output')" - num="$(printf "%s\n" "$outputs" \ - | grep -Fxn "$name" \ - | cut -d: -f1)" - num="$((num - 1))" - - # Omit the number on the first monitor - [ "$num" -gt 0 ] || num= - - workspace="$num$1" -fi +# NOTE: See `strip-wsnames` in polybar config. With it every monitor has its own +# 1-10 workspaces +workspace="$1: $name" if [ -z "$switch" ] && [ -z "$move" ]; then printf "%s\n" "$workspace" diff --git a/.config/polybar/config b/.config/polybar/config index b2ac78f..68a212a 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -40,6 +40,7 @@ enable-ipc = true type = internal/i3 pin-workspaces = true format = +strip-wsnames = true index-sort = true wrapping-scroll = false