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))
|
shift $((OPTIND - 1))
|
||||||
[ $# -gt 0 ] || usage
|
[ $# -gt 0 ] || usage
|
||||||
|
|
||||||
outputs="$(i3-msg -t get_outputs | jq -r '.[] | select(.active).name')"
|
name="$(i3-msg -t get_tree \
|
||||||
num_outs="$(printf "%s\n" "$outputs" | wc -l)"
|
|
||||||
|
|
||||||
if [ "$num_outs" -lt 2 ]; then
|
|
||||||
# only one monitor
|
|
||||||
workspace="$1"
|
|
||||||
else
|
|
||||||
name="$(i3-msg -t get_tree \
|
|
||||||
| jq -r '.. | objects | select(.focused).output')"
|
| 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
|
# NOTE: See `strip-wsnames` in polybar config. With it every monitor has its own
|
||||||
[ "$num" -gt 0 ] || num=
|
# 1-10 workspaces
|
||||||
|
workspace="$1: $name"
|
||||||
workspace="$num$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$switch" ] && [ -z "$move" ]; then
|
if [ -z "$switch" ] && [ -z "$move" ]; then
|
||||||
printf "%s\n" "$workspace"
|
printf "%s\n" "$workspace"
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ enable-ipc = true
|
|||||||
type = internal/i3
|
type = internal/i3
|
||||||
pin-workspaces = true
|
pin-workspaces = true
|
||||||
format = <label-state> <label-mode>
|
format = <label-state> <label-mode>
|
||||||
|
strip-wsnames = true
|
||||||
index-sort = true
|
index-sort = true
|
||||||
wrapping-scroll = false
|
wrapping-scroll = false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user