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.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -40,6 +40,7 @@ enable-ipc = true
|
||||
type = internal/i3
|
||||
pin-workspaces = true
|
||||
format = <label-state> <label-mode>
|
||||
strip-wsnames = true
|
||||
index-sort = true
|
||||
wrapping-scroll = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user