Add the "improved-workspace-indicator" GNOME extension
This commit is contained in:
parent
f9601c310c
commit
f52d4e4cc6
6 changed files with 124 additions and 5 deletions
38
.local/bin/workspace-switch-to-empty
Executable file
38
.local/bin/workspace-switch-to-empty
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Jump to the first empty workspace
|
||||
#
|
||||
# Triggered by <Super>n
|
||||
# as defined in [org/gnome/settings-daemon/plugins/media-keys]
|
||||
# in ~/.config/gnome-settings/key-bindings.ini
|
||||
#
|
||||
# Note: This assumes that only the main monitor has workspaces enabled
|
||||
# (see ~/.local/bin/move-window-to-empty-workspace)
|
||||
|
||||
set -eu
|
||||
|
||||
|
||||
occupied=$(wmctrl -l) || exit 1 # fail safe
|
||||
occupied=$(echo "$occupied" | awk '{print $2}' | sort -u)
|
||||
|
||||
total=$(wmctrl -d | wc -l)
|
||||
|
||||
|
||||
# 0-based index for the first workspace
|
||||
i=0
|
||||
|
||||
while [ "$i" -lt "$total" ]; do
|
||||
|
||||
if ! echo "$occupied" | grep -qx "$i"; then
|
||||
exec wmctrl -s "$i"
|
||||
fi
|
||||
|
||||
i=$((i + 1))
|
||||
|
||||
done
|
||||
|
||||
|
||||
command -v notify-send >/dev/null \
|
||||
&& notify-send 'Workspaces' 'No empty workspace available'
|
||||
|
||||
exit 1
|
||||
Loading…
Reference in a new issue