From e996b6626c85f8cefb0f357d128091e350ee0ec0 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 15 Sep 2026 12:58:31 +0200 Subject: 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 --- install.sh | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100755 install.sh (limited to 'install.sh') diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..2561bcc --- /dev/null +++ b/install.sh @@ -0,0 +1,130 @@ +#!/bin/bash +# Install waybar-theme-udt by symlink, so the repo stays canonical. +# Copyright (C) 2026 Danilo M. +# Licensed under the GNU General Public License v2 only. +# +# This installs a SECOND bar, at ~/.config/waybar-udt/. The existing bar at +# ~/.config/waybar/ is left alone, so DP-1 keeps working while this one is +# tried on DP-3. Nothing is started: the command to run it is printed at the +# end. +set -euo pipefail + +repo="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +target="$HOME/.config/waybar-udt" +udt="$(cd "$repo/../unified-desktop-theme" 2>/dev/null && pwd || true)" +icons="$HOME/.local/share/icons/Material-Black-Plum-Suru" + +mkdir -p "$target/modules/hyprland" "$target/modules/custom" \ + "$target/modules/extras" "$target/modules/image" \ + "$target/styles" "$HOME/bin" + +# ---------------------------------------------------------------- colours -- +# The palette is udt's, not this repo's. Generating it needs the sibling +# checkout, so a missing one is a clear failure rather than a bar with no +# colours: every stylesheet below names @main-bg and friends. +if [ -z "$udt" ]; then + echo "error: unified-desktop-theme not found next to this repo" >&2 + echo " expected at $repo/../unified-desktop-theme" >&2 + exit 1 +fi +"$udt/bin/udt-palette" +install -Dm644 "$udt/templates/waybar/theme.css" "$target/styles/theme.css" + +# The dot scripts are bash, not CSS, so they cannot read @define-color. Write +# the handful of colours they need as a shell fragment they source. +# +# The values are read back out of the stylesheet udt-palette just generated, +# because that is the only place they exist in a form this script can see: +# udt-palette renders files, it does not answer queries about single roles. +# +# Pango wants a colour it can parse, and the generated file mixes #rrggbb with +# rgb()/rgba() spellings, so each is normalised to hex on the way out. +scheme="$(sed -n 's/^scheme *= *//p' "$HOME/.config/udt/roles.conf")" + +css_color() { + # Last definition wins, matching how GTK resolves a redefined colour. + sed -n "s/^@define-color $1 *\(.*\);\$/\1/p" "$target/styles/theme.css" | tail -1 +} + +to_hex() { + python3 -c ' +import re, sys +v = sys.argv[1].strip() +m = re.match(r"rgba?\(([^)]*)\)", v) +if m: + p = [x.strip() for x in m.group(1).split(",")] + print("#%02x%02x%02x" % tuple(int(float(c)) for c in p[:3])) +else: + print(v) +' "$2" +} + +{ + echo "# Generated by waybar-theme-udt/install.sh from the $scheme scheme." + echo "# Sourced by vms_dots.sh and privacy_dots.sh. Do not edit." + # The generated stylesheet carries no success/info roles, so the dots use + # the palette names it does define. green/teal/mauve are role-resolved by + # udt-palette, so they still follow the scheme. + for pair in "SUCCESS:green" "WARNING:warning" "CRITICAL:critical" \ + "INFO:teal" "ACCENT:mauve" "FAINT:overlay0"; do + var="${pair%%:*}" + raw="$(css_color "${pair##*:}")" + [ -n "$raw" ] && printf 'DOT_%s="%s"\n' "$var" "$(to_hex "$var" "$raw")" + done +} > "$target/dots.colors" + +# ------------------------------------------------------------------ files -- +# Config and modules are symlinked: this repo owns them outright, so linking +# means the installed bar cannot drift from what is committed. +ln -sfn "$repo/config.jsonc" "$target/config.jsonc" +for f in modules/clock.jsonc \ + modules/hyprland/workspaces.jsonc \ + modules/custom/launcher.jsonc modules/custom/vmdot.jsonc \ + modules/custom/privacy_dots.jsonc \ + modules/extras/taskbar.jsonc modules/extras/tray.jsonc \ + modules/image/volume.jsonc modules/image/idle_inhibitor.jsonc \ + modules/image/language.jsonc; do + ln -sfn "$repo/$f" "$target/$f" +done + +for f in style.css fonts.css global.css pills.css; do + ln -sfn "$repo/styles/$f" "$target/styles/$f" +done + +# modules.css is generated rather than linked: it carries the icon theme's +# absolute path, which cannot be committed, and the accent-tinted launcher. +sed -e "s|@ICONS@|$icons|g" -e "s|@CONFIG@|$target|g" \ + "$repo/styles/modules.css" > "$target/styles/modules.css" + +# The flags ship as they are; the Slackware mark is monochrome, so it takes +# the accent. Read from the generated palette rather than restated here. +accent="$(sed -n 's/^@define-color accent *\(.*\);$/\1/p' "$target/styles/theme.css" | head -1)" +accent="${accent:-#b7bdf8}" +sed "s|@ACCENT@|$accent|" "$repo/icons/slackware.svg" > "$target/slackware.svg" +install -Dm644 "$repo/icons/flag-it.svg" "$target/flag-it.svg" +install -Dm644 "$repo/icons/flag-gb.svg" "$target/flag-gb.svg" + +# ---------------------------------------------------------------- scripts -- +# The two dot scripts used to live only in ~/bin, in no repository at all. +# They are this repo's now, and ~/bin gets links. Any real file found there is +# kept: it is the only copy of whatever was running before. +for s in vms_dots.sh privacy_dots.sh; do + if [ -f "$HOME/bin/$s" ] && [ ! -L "$HOME/bin/$s" ]; then + mv "$HOME/bin/$s" "$HOME/bin/$s.pre-udt" + echo "kept your $s as ~/bin/$s.pre-udt" + fi + ln -sfn "$repo/bin/$s" "$HOME/bin/$s" +done +ln -sfn "$repo/bin/wb-icon" "$HOME/bin/wb-icon" +ln -sfn "$repo/bin/wb-idle" "$HOME/bin/wb-idle" +ln -sfn "$repo/bin/wb-lang" "$HOME/bin/wb-lang" + +# ----------------------------------------------------------------- checks -- +# A missing icon renders as an empty pill and nothing says why, so the names +# are checked here, while someone is watching. +"$repo/bin/wb-icon" --selftest + +echo +echo "installed to $target" +echo "run it with: waybar -c $target/config.jsonc -s $target/styles/style.css" +echo "your existing bar on DP-1 is untouched." -- cgit v1.2.3