diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-15 12:58:31 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-15 12:58:31 +0200 |
| commit | e996b6626c85f8cefb0f357d128091e350ee0ec0 (patch) | |
| tree | e74b93bb7a7c0451f7e247d541b2b428b096df19 /bin/wb-lang | |
| download | waybar-theme-udt-e996b6626c85f8cefb0f357d128091e350ee0ec0.tar.gz waybar-theme-udt-e996b6626c85f8cefb0f357d128091e350ee0ec0.zip | |
feat: a waybar bar for DP-3, themed by udt and drawn with icons
Builds the bar from scratch as a consumer of unified-desktop-theme: the
palette comes from there, the layout and the modules live here.
No font glyphs anywhere. Every symbol is a real icon from the icon theme
GTK already uses, which needs all three of waybar's mechanisms because no
single one covers everything: the icon-theme config key for the taskbar
and tray, `image` modules driving wb-icon/wb-lang for volume, microphone,
presentation mode and the keyboard flag, and CSS background-image for the
workspaces, the clock pair and the launcher.
The workspace icons have to be CSS because format-icons takes text rather
than paths, and faking the strip with eight custom modules would have cost
click-to-switch and the active and urgent states. The language flag goes
the other way: hyprland/language styles as #language with no per-language
class, so the flag could not be selected, and it is an image module.
Icons keep their own colours: 2466 of the theme's 5169 panel icons carry a
hardcoded gradient and are not recolourable, which is the intended look
here. The two icons the theme lacks are shipped instead, and the monochrome
Slackware mark takes the udt accent at install time.
vms_dots.sh and privacy_dots.sh lived only in ~/bin, in no repository at
all. They are versioned here now, symlinked back, and their hardcoded
state colours read from the palette.
Installs alongside the existing bar rather than over it, so DP-1 keeps
working while this one is tried on DP-3.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'bin/wb-lang')
| -rwxr-xr-x | bin/wb-lang | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/bin/wb-lang b/bin/wb-lang new file mode 100755 index 0000000..5a0cd5d --- /dev/null +++ b/bin/wb-lang @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# Keyboard layout, as a flag. +# Copyright (C) 2026 Danilo M. <danix@danix.xyz> +# Licensed under the GNU General Public License v2 only. +# +# waybar's hyprland/language module styles as #language and nothing else: it +# has no per-language CSS class, so a flag cannot be selected by a selector. +# format-<lang> exists but takes text, not a path. So the flag arrives the +# same way every other icon on this bar does, through an `image` module. +# +# wb-lang # print "$path\n$tooltip" for the image module +# +# The flags live next to this bar's config because the icon theme ships 13 and +# neither Italian nor British is among them. +set -euo pipefail + +flags="$HOME/.config/waybar-udt" + +# hyprctl names the layout in full ("Italian", "English (US)"), which is what +# the keymap reports; match on that rather than on the short code, because the +# short code is not in this output. +layout="$(hyprctl devices -j 2>/dev/null \ + | python3 -c 'import json,sys +try: + d = json.load(sys.stdin) +except Exception: + sys.exit(0) +for k in d.get("keyboards", []): + if k.get("name") == "2.4g-dongle": + print(k.get("active_keymap", "")) + break' 2>/dev/null || true)" + +case "$layout" in +Italian*) flag="flag-it.svg"; name="Italian" ;; +English*) flag="flag-gb.svg"; name="English" ;; +"") flag="flag-it.svg"; name="unknown" ;; +*) flag="flag-gb.svg"; name="$layout" ;; +esac + +if [[ ! -r "$flags/$flag" ]]; then + echo "wb-lang: missing $flags/$flag" >&2 + exit 1 +fi + +echo "$flags/$flag" +echo "Layout: $name" |
