diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-17 08:07:00 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-17 08:07:00 +0200 |
| commit | 121235db5ca23e53e0dad3a402c521dc7a940fbc (patch) | |
| tree | a899aff77c6cd08ee763d418d4904e51eaf3bb5c /styles | |
| parent | 2c23c9cc2fa5c26e408e7276f7da7d0cb37922d6 (diff) | |
| download | waybar-theme-udt-121235db5ca23e53e0dad3a402c521dc7a940fbc.tar.gz waybar-theme-udt-121235db5ca23e53e0dad3a402c521dc7a940fbc.zip | |
feat(icons): read the icon theme from gsettings
The icon theme name was hardcoded in three places (bin/wb-icon,
modules/extras/taskbar.jsonc and install.sh), so switching themes in the
appearance drawer was silently reverted as far as this bar was concerned.
wb-icon now reads org.gnome.desktop.interface icon-theme and gains two modes
for install.sh: --path NAME prints one icon's absolute path, --theme prints
the resolved theme name.
Icons are resolved per name rather than by substituting a directory prefix,
because themes disagree about both subdirectory and file extension: the Suru
themes keep web-browser at categories/22/*.svg, elementary-xfce at
apps/22/*.png. Only a real GTK lookup knows the path.
styles/modules.css therefore carries @ICON:name@ placeholders and
modules/extras/taskbar.jsonc carries @ICON_THEME@, both filled at install
time. taskbar.jsonc is generated rather than symlinked for that reason, and
install.sh removes the old symlink first so the redirect cannot overwrite the
committed source.
A theme missing one of the twenty names fails the install at the --selftest
step rather than drawing empty pills.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'styles')
| -rw-r--r-- | styles/modules.css | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/styles/modules.css b/styles/modules.css index ee5c4b2..b6fd38d 100644 --- a/styles/modules.css +++ b/styles/modules.css @@ -2,8 +2,10 @@ * * The icons for the workspaces, the clock pair, the launcher and the language * live here rather than in the config, because waybar's format-icons takes - * text and not paths. @ICONS@ is substituted by install.sh with the icon - * theme's absolute path, so the theme can move without editing this file. + * text and not paths. Each icon placeholder below is substituted by install.sh + * with the absolute path `wb-icon --path <name>` resolves, so this file names + * icons and never a directory: themes disagree about both subdirectory and + * file extension, and only a real icon lookup knows which. */ /* ------------------------------------------------------------------ * @@ -59,11 +61,11 @@ } #clock.date { - background-image: url("@ICONS@/mimetypes/22/x-office-calendar.svg"); + background-image: url("@ICON:x-office-calendar@"); } #clock.time { - background-image: url("@ICONS@/categories/22/clock.svg"); + background-image: url("@ICON:clock@"); } /* ------------------------------------------------------------- * @@ -104,14 +106,14 @@ /* The eight. Generic names, so the bar does not lie when the application on a * workspace changes. */ -#workspaces button:nth-child(1) { background-image: url("@ICONS@/categories/22/web-browser.svg"); } -#workspaces button:nth-child(2) { background-image: url("@ICONS@/categories/22/text-editor.svg"); } -#workspaces button:nth-child(3) { background-image: url("@ICONS@/categories/22/utilities-terminal.svg"); } -#workspaces button:nth-child(4) { background-image: url("@ICONS@/devices/22/network-server.svg"); } -#workspaces button:nth-child(5) { background-image: url("@ICONS@/actions/22/document-edit.svg"); } -#workspaces button:nth-child(6) { background-image: url("@ICONS@/categories/22/applications-graphics.svg"); } -#workspaces button:nth-child(7) { background-image: url("@ICONS@/actions/22/dialog-messages.svg"); } -#workspaces button:nth-child(8) { background-image: url("@ICONS@/devices/22/input-gaming.svg"); } +#workspaces button:nth-child(1) { background-image: url("@ICON:web-browser@"); } +#workspaces button:nth-child(2) { background-image: url("@ICON:text-editor@"); } +#workspaces button:nth-child(3) { background-image: url("@ICON:utilities-terminal@"); } +#workspaces button:nth-child(4) { background-image: url("@ICON:network-server@"); } +#workspaces button:nth-child(5) { background-image: url("@ICON:document-edit@"); } +#workspaces button:nth-child(6) { background-image: url("@ICON:applications-graphics@"); } +#workspaces button:nth-child(7) { background-image: url("@ICON:dialog-messages@"); } +#workspaces button:nth-child(8) { background-image: url("@ICON:input-gaming@"); } /* ------------------------------------------------ * * Language: a flag, shipped by this repo. * @@ -135,7 +137,7 @@ * ------------------------------------------------------ */ #custom-mail { - background-image: url("@ICONS@/actions/22/mail-unread.svg"); + background-image: url("@ICON:mail-unread@"); background-repeat: no-repeat; background-position: 10px center; background-size: 16px 16px; @@ -240,13 +242,13 @@ } #custom-presentation.deactivated { - background-image: url("@ICONS@/categories/22/preferences-desktop-screensaver.svg"); + background-image: url("@ICON:preferences-desktop-screensaver@"); } #custom-presentation.activated { - background-image: url("@ICONS@/mimetypes/22/x-office-presentation.svg"); + background-image: url("@ICON:x-office-presentation@"); } #custom-presentation.down { - background-image: url("@ICONS@/status/22/dialog-warning.svg"); + background-image: url("@ICON:dialog-warning@"); } |
