From 5599ce14d7764f496185914d0b7b4f24f1a9e51b Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 4 Dec 2025 14:20:40 +0100 Subject: [PATCH] i3: Normal numeric workspaces on multi outputs Use normal workspace numbers with the output name as workspace name, but strip the name in polybar. See https://github.com/polybar/polybar/pull/3230 for strip-wsnames. --- .config/i3/multi-monitor-workspaces.sh | 23 +++++------------------ .config/polybar/config | 1 + 2 files changed, 6 insertions(+), 18 deletions(-) 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