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
|
|
@ -100,8 +100,8 @@
|
|||
# ------------------+------------------------+------------------------+------------------------+------------------------+------------------------
|
||||
# grave ~ ` | | | Swap last two windows | |
|
||||
# | | | | |
|
||||
# n | | Move window to ... | | |
|
||||
# | | ... first empty WS | | |
|
||||
# n | Jump to first ... | Move window to ... | | |
|
||||
# | ... empty WS | ... first empty WS | | |
|
||||
# | | | | |
|
||||
# | Jump to WS ... | Move window to WS ... | | |
|
||||
# 1 to 0 | ... No. 1 to 0 | ... No. 1 to 0 | | |
|
||||
|
|
@ -495,7 +495,7 @@ keyboard-brightness-toggle=['<Super><Alt>slash']
|
|||
# Due to the structure of the below groups,
|
||||
# we must duplicate some of them to allow multiple bindings
|
||||
|
||||
custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_key_bindings/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/move_window_to_empty_workspace/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/list_windows/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_launcher_1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_launcher_2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_run_1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_run_2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_primary_terminal_1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_primary_terminal_2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_secondary_terminal_1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_secondary_terminal_2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_file_manager/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_firefox/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_chromium/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_google_chrome/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_evolution/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/dark_scheme_toggle/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/night_light_force/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/night_light_toggle/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/night_light_make_cooler/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/night_light_make_warmer/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/randomize_background/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/wifi_toggle/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/restart_gnome_shell/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/emoji_picker_type/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/emoji_picker_copy/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/vault_toggle/']
|
||||
custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_key_bindings/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/move_window_to_empty_workspace/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/list_windows/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_launcher_1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_launcher_2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_run_1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_run_2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_primary_terminal_1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_primary_terminal_2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_secondary_terminal_1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_secondary_terminal_2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_file_manager/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_firefox/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_chromium/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_google_chrome/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch_evolution/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/dark_scheme_toggle/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/night_light_force/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/night_light_toggle/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/night_light_make_cooler/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/night_light_make_warmer/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/randomize_background/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/wifi_toggle/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/restart_gnome_shell/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/emoji_picker_type/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/emoji_picker_copy/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/vault_toggle/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/workspace_switch_to_empty/']
|
||||
|
||||
|
||||
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/show_key_bindings]
|
||||
|
|
@ -653,6 +653,12 @@ command='/home/user/.local/bin/vault-toggle'
|
|||
name='(Un-)Mount the vault'
|
||||
|
||||
|
||||
[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/workspace_switch_to_empty]
|
||||
binding='<Super>n'
|
||||
command='/home/user/.local/bin/workspace-switch-to-empty'
|
||||
name='Jump to first empty workspace'
|
||||
|
||||
|
||||
|
||||
[org/gnome/shell/keybindings]
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
[org/gnome/shell]
|
||||
|
||||
enabled-extensions=['AlphabeticalAppGrid@stuarthayhurst', 'app-hider@lynith.dev', 'appindicator-hider@theophilediot.github.io', 'appindicatorsupport@rgcjonas.gmail.com', 'drive-menu@gnome-shell-extensions.gcampax.github.com', 'forge@jmmaranan.com', 'just-perfection-desktop@just-perfection', 'launch-new-instance@gnome-shell-extensions.gcampax.github.com', 'light-style@gnome-shell-extensions.gcampax.github.com', 'no-screenshot-box@screenshot', 'panel-date-format@keiii.github.com']
|
||||
enabled-extensions=['AlphabeticalAppGrid@stuarthayhurst', 'app-hider@lynith.dev', 'appindicator-hider@theophilediot.github.io', 'appindicatorsupport@rgcjonas.gmail.com', 'drive-menu@gnome-shell-extensions.gcampax.github.com', 'forge@jmmaranan.com', 'improved-workspace-indicator@michaelaquilina.github.io', 'just-perfection-desktop@just-perfection', 'launch-new-instance@gnome-shell-extensions.gcampax.github.com', 'light-style@gnome-shell-extensions.gcampax.github.com', 'no-screenshot-box@screenshot', 'panel-date-format@keiii.github.com']
|
||||
|
||||
disabled-extensions=@as []
|
||||
|
||||
|
|
@ -112,6 +112,28 @@ window-gap-size-increment=uint32 2
|
|||
|
||||
|
||||
|
||||
[org/gnome/shell/extensions/improved-workspace-indicator]
|
||||
|
||||
panel-position='left'
|
||||
|
||||
# Only workspaces with windows are listed
|
||||
skip-taskbar-mode=true
|
||||
|
||||
change-on-click=true
|
||||
change-on-scroll=false
|
||||
|
||||
wrap-scroll=true
|
||||
|
||||
# `just-perfection` already hides the "Activities" button
|
||||
hide-activities=false
|
||||
|
||||
hide-single-workspaces=false
|
||||
|
||||
# Written by ~/.local/bin/color-palette
|
||||
custom-css-path='/home/user/.config/improved-workspace-indicator/stylesheet.css'
|
||||
|
||||
|
||||
|
||||
[org/gnome/shell/extensions/just-perfection]
|
||||
|
||||
support-notifier-type=0
|
||||
|
|
|
|||
7
.config/improved-workspace-indicator/README.md
Normal file
7
.config/improved-workspace-indicator/README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Improved Workspace Indicator Configurations
|
||||
|
||||
This folder contains the stylesheet
|
||||
for the [Improved Workspace Indicator GNOME shell extension](https://extensions.gnome.org/extension/3968/improved-workspace-indicator/).
|
||||
|
||||
`stylesheet.css` is untracked
|
||||
and written by [`color-palette`](../../.local/bin/color-palette).
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
# This file's name matches the CLI convention in ~/.local/bin
|
||||
# pylint: disable=invalid-name
|
||||
|
||||
# Templates for six consumers live here
|
||||
# Templates for seven consumers live here
|
||||
# => Length of file is managable
|
||||
# pylint: disable=too-many-lines
|
||||
|
||||
|
|
@ -884,6 +884,41 @@ def render_rofi(colors: dict[str, str]) -> str:
|
|||
""")
|
||||
|
||||
|
||||
def render_workspace_indicator(colors: dict[str, str]) -> str:
|
||||
"""Render ~/.config/improved-workspace-indicator/stylesheet.css."""
|
||||
return textwrap.dedent(f"""\
|
||||
/* Written by ~/.local/bin/color-palette */
|
||||
/* accent={colors['_accent']} scheme={colors['_scheme']} */
|
||||
|
||||
.panel-workspace-indicator {{
|
||||
padding: 0 2px;
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
}}
|
||||
|
||||
.panel-workspace-indicator-box {{
|
||||
padding: 0;
|
||||
}}
|
||||
|
||||
.panel-workspace-indicator {{
|
||||
padding: 1px 8px;
|
||||
margin: 0 3px;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
font-size: 10pt;
|
||||
font-weight: 600;
|
||||
color: {colors['chrome-quiet']};
|
||||
background-color: {colors['surface-dim']};
|
||||
}}
|
||||
|
||||
.panel-workspace-indicator.workspace-indicator-active {{
|
||||
font-weight: 700;
|
||||
color: {colors['text']};
|
||||
background-color: {colors['accent']};
|
||||
}}
|
||||
""")
|
||||
|
||||
|
||||
def show_colors(colors: dict[str, str]) -> None:
|
||||
"""Print all derived colors of this run for debugging."""
|
||||
print(
|
||||
|
|
@ -997,6 +1032,10 @@ def write_consumers(colors: dict[str, str]) -> int:
|
|||
content=render_rofi(colors),
|
||||
target=config_home / "rofi" / "colors.rasi",
|
||||
),
|
||||
write_file(
|
||||
content=render_workspace_indicator(colors),
|
||||
target=config_home / "improved-workspace-indicator" / "stylesheet.css",
|
||||
),
|
||||
)
|
||||
|
||||
return 0 if all(results) else 1
|
||||
|
|
|
|||
|
|
@ -48,5 +48,12 @@ if gnome-extensions list --enabled 2>/dev/null | grep -qxF "forge@jmmaranan.com"
|
|||
gsettings set $Forge window-gap-size "uint32 $_gap"
|
||||
fi
|
||||
|
||||
# The "workspace indicator" extension only re-reads its stylesheet on a restart
|
||||
_iwi=improved-workspace-indicator@michaelaquilina.github.io
|
||||
if gnome-extensions list --enabled 2>/dev/null | grep -qxF "$_iwi"; then
|
||||
gnome-extensions disable "$_iwi"
|
||||
gnome-extensions enable "$_iwi"
|
||||
fi
|
||||
|
||||
|
||||
echo "Switched the color theme to $new_theme"
|
||||
|
|
|
|||
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