From 037d3116079f97d0526b5135ffdf765f53a9f16c Mon Sep 17 00:00:00 2001 From: nevaforget Date: Tue, 7 Apr 2026 17:27:47 +0200 Subject: [PATCH] refactor: clean up Waybar styles, remove user-defaults mechanism MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove defaults/user/ and the user-defaults copy loop from post-install.sh and transform.sh — Waybar falls back to /etc/xdg/waybar/ via XDG spec, no provisioning needed. - Remove USER_DEFAULTS constant from lib.sh. - Clean up style.css: remove dead selectors (#net, #cava, #custom-updates, #custom-notification), commented-out blocks, empty rules, duplicate properties, and hardcoded hex color. - Restructure module styling: generic top-level box via > widget > *, group children reset via widget widget > *, explicit exceptions for workspaces/taskbar/window. - Normalize section comments and whitespace. - Update README to remove user/waybar/ from project structure. --- README.md | 1 - defaults/user/waybar/config | 33 ----- defaults/user/waybar/style.css | 18 --- defaults/xdg/waybar/style.css | 234 +++++++-------------------------- scripts/lib.sh | 1 - scripts/post-install.sh | 26 ---- scripts/transform.sh | 17 --- 7 files changed, 50 insertions(+), 280 deletions(-) delete mode 100644 defaults/user/waybar/config delete mode 100644 defaults/user/waybar/style.css diff --git a/README.md b/README.md index 708ce9e..54cf740 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,6 @@ defaults/ etc/greetd/ greetd daemon + greeter Niri config etc/moongreet/ moongreet configuration etc/systemd/user/ Systemd user services (cliphist, kanshi, walker, nautilus) - user/waybar/ Per-user Waybar overrides (only copied if missing) backgrounds/wallpaper.jpg Default wallpaper (shared by desktop, greeter, lock screen) ``` diff --git a/defaults/user/waybar/config b/defaults/user/waybar/config deleted file mode 100644 index dc6ad3d..0000000 --- a/defaults/user/waybar/config +++ /dev/null @@ -1,33 +0,0 @@ -{ - // ABOUTME: User override for Waybar — extends the system-wide config from /etc/xdg/waybar/. - // ABOUTME: Define custom modules here and add them to modules-left/center/right. - - // Load system-wide Moonarch config as base. - // Properties defined here override those from the include. - "include": ["/etc/xdg/waybar/config"] - - // Example: extend module bar (must be specified completely as it replaces - // the system-wide one): - // - // "modules-right": [ - // "mpris", - // "custom/cpugov", - // "group/net", - // "group/sound", - // "backlight", - // "custom/keyboard", - // "battery", - // "group/indicators" - // ], - - // Example: show HID++ device battery (e.g. Logitech keyboard) - // moonarch-waybar-hidpp finds the correct hidpp_battery_* entry dynamically - // - // "custom/keyboard": { - // "exec": "moonarch-waybar-hidpp 'G515 LS TKL'", - // "return-type": "json", - // "interval": 120, - // "format": "{}", - // "exec-on-event": false - // } -} diff --git a/defaults/user/waybar/style.css b/defaults/user/waybar/style.css deleted file mode 100644 index afdf68c..0000000 --- a/defaults/user/waybar/style.css +++ /dev/null @@ -1,18 +0,0 @@ -/* ABOUTME: User override for Waybar styling — extends the system-wide style.css. */ -/* ABOUTME: Define custom styles here, the system-wide base is loaded via @import. */ - -@import url("/etc/xdg/waybar/style.css"); - -/* Add custom styles below. */ -/* Selectors from the system-wide config can be overridden here. */ - -/* Example: color Logitech keyboard battery */ -/* -#battery-keyboard.warning:not(.charging) { - color: #e6a200; -} - -#battery-keyboard.critical:not(.charging) { - color: #cc3436; -} -*/ diff --git a/defaults/xdg/waybar/style.css b/defaults/xdg/waybar/style.css index d6e4711..3794e52 100644 --- a/defaults/xdg/waybar/style.css +++ b/defaults/xdg/waybar/style.css @@ -1,3 +1,6 @@ +/* ABOUTME: System-wide Waybar styling for Moonarch. */ +/* ABOUTME: Uses GTK theme colors via @theme_* variables, Catppuccin Mocha palette. */ + * { border: none; font-family: "Ubuntu Nerd Font", sans-serif; @@ -6,17 +9,15 @@ } window#waybar { - /*background: transparent;*/ background: alpha(@theme_selected_fg_color, 0.2); } -/*-----main groups----*/ -.modules-right { +/* --- Main groups --- */ + +.modules-left { margin: 0; padding-left: 5px; - padding-right: 0; border-radius: 0; - } .modules-center { @@ -24,106 +25,62 @@ window#waybar { border-radius: 0; } -.modules-left { - margin: 0 0 0 5px; - /* background-color:alpha(@theme_selected_bg_color, 0.15); - background: @theme_bg_color */ +.modules-right { + margin: 0; + padding-left: 5px; + padding-right: 5px; border-radius: 0; - margin-left: 5px; } -/** -## ALL MODULES -**/ -#clock, -#battery, -#backlight, -#cpu, -#memory, -#bluetooth, -#temperature, -#pulseaudio, -#tray, -#mode, -#idle_inhibitor, -#workspaces, -#custom-power, -#custom-menu, -#custom-media, -#custom-notification, -#custom-updates, -#custom-pacman, -#user, -#cava, -#custom-gpu-usage, -#custom-cpugov, +/* --- Default module box (top-level modules and groups) --- */ -#power-profiles-daemon, -#privacy, -#gamemode, +.modules-left > widget > *, +.modules-center > widget > *, +.modules-right > widget > * { + padding: 0px 10px; + border-radius: 4px; + margin: 8px 2px; + background-color: alpha(@theme_selected_bg_color, 0.05); +} + +/* Exceptions: no box styling */ +#workspaces, #taskbar, #window { - padding: 0px 10px; + border-radius: 0; + margin: 0; + padding: 0; + background-color: transparent; } -/** -* GROUPS -**/ +/* Group children: compact inside group box */ +widget widget > * { + padding: 0 6px; + margin: 0; + background-color: transparent; + border-radius: 0; +} + +/* --- Groups --- */ + #sys, #stats, -#net, -#sound { - margin: 0; +#sound, +#indicators { + padding: 0 4px; color: alpha(@theme_text_color, 0.5); } - -/** -* SYS -**/ -#sys { - padding: 0 0px 0 10px; -} - -#custom-power { - margin-left: 0; - margin-right: 0; - padding-left: 0; -} - -#user { - padding-left: 0; - font-weight: bold; -} - -#custom-weather { - padding-left: 5px; -} - - #stats .drawer-child { padding-left: 10px; padding-right: 10px; } #tray { - border-radius: 4px; - padding: 0px 8px 0px 8px; - margin: 8px 0px 8px 0px; + padding: 0; } -#custom-notification { - padding-right: 0 -} - -/** -* SOUND -**/ - -#cava { - background-color: transparent; - padding-left: 0; -} +/* --- Sound --- */ #pulseaudio-slider { padding-left: 10px; @@ -138,7 +95,6 @@ window#waybar { border: none; box-shadow: none; background-color: @insensitive_bg_color; - border: 1px solid alpha(@theme_selected_bg_color, 0.1); } #pulseaudio-slider trough { @@ -149,97 +105,34 @@ window#waybar { } #pulseaudio-slider highlight { - min-width: 5px; border-radius: 5px; - background-color: #6c7086; + background-color: alpha(@theme_selected_bg_color, 0.5); } -#custom-updates { - padding-right: 5px; - padding-left: 5px; -} +/* --- Misc --- */ - -/** -* MISC -**/ #mpris { border-radius: 0; margin: 8px 10px 8px 0px; padding: 0 10px; } -/** -* WORKSPACES -**/ -/*#workspaces { - padding: 0; - border-radius: 0 -} +/* --- Workspaces --- */ #workspaces button { - padding: 0px 10px 0px 8px; - margin: 8px 2px 8px 0px; + margin: 8px 2px; + padding: 0 2px 0 0; outline: none; border-radius: 4px; background-color: alpha(@theme_selected_bg_color, 0.05); } -#workspaces button:last-child { - margin-right: 0; -} - -#workspaces button.empty, -#workspaces button.active.empty { - color: inherit; - padding: 0px 0px 0px 8px; -} - -#workspaces button.active { - background-color: transparent; - padding: 0px 10px 0px 8px; -} - -#workspaces button.visible { - background-color: alpha(@theme_selected_bg_color, 0.1); -} - -#workspaces button.urgent { - color: #cc3436; -} - -#workspaces button:hover { - background-color: alpha(@theme_selected_bg_color, 0.05); - box-shadow: inherit; - text-shadow: inherit; -}*/ - -#workspaces { - padding: 0; - border-radius: 0; - -} - -#workspaces button { - margin: 8px 2px 8px 0px; - padding: 0; - outline: none; - border-radius: 4px; - background-color: alpha(@theme_selected_bg_color, 0.05); -} - -#workspaces button:last-child { - margin-right: 0; -} - #workspaces button.empty, #workspaces button.active.empty { color: inherit; } -#workspaces button.active {} - #workspaces button.visible { background-color: alpha(@theme_selected_bg_color, 0.1); } @@ -254,10 +147,8 @@ window#waybar { text-shadow: inherit; } +/* --- Indicators --- */ -/** -## INDICATORS -**/ #pulseaudio.muted { color: #cc3436; } @@ -282,22 +173,11 @@ window#waybar { color: alpha(@theme_selected_bg_color, 0.9); } -#indicators { - padding-right: 5px; - padding-left: 5px; - border-radius: 0; -} +/* --- Taskbar --- */ - -/** -* TASKBAR -**/ #taskbar { font-size: 8px; - margin: 0 0 0 5px; opacity: 1; - padding: 0; - border-radius: 0; } #taskbar.empty { @@ -305,28 +185,16 @@ window#waybar { } #taskbar button { - padding: 3px 10px 3px 10px; + padding: 0 4px 0 10px; transition: 100ms border ease-in-out; border-radius: 0; - font-size: 8px; } -#taskbar button:not(:first-child) { - border-radius: 0px; -} - -#taskbar button:first-child {} - -#taskbar button:last-child {} - -#taskbar button:last-child:first-child {} - #taskbar button.empty { opacity: 0; } #taskbar button:hover { - background-color: alpha(@theme_selected_bg_color, 0.1); } @@ -335,12 +203,10 @@ window#waybar { opacity: 1; } - menu { border-radius: 4px; } menuitem { border-radius: 4px; - -} \ No newline at end of file +} diff --git a/scripts/lib.sh b/scripts/lib.sh index 706d674..96577f7 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -8,7 +8,6 @@ PROJECT_DIR="$(dirname "$SCRIPT_DIR")" OFFICIAL_PACKAGES="$PROJECT_DIR/packages/official.txt" AUR_PACKAGES="$PROJECT_DIR/packages/aur.txt" DEFAULTS_DIR="$PROJECT_DIR/defaults" -USER_DEFAULTS="/usr/share/moonarch/user-defaults" # --- Helper functions --- diff --git a/scripts/post-install.sh b/scripts/post-install.sh index d9b23ff..85c1189 100755 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -110,32 +110,6 @@ gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' gsettings set org.gnome.desktop.interface icon-theme 'Colloid-Grey-Catppuccin-Dark' gsettings set org.gnome.desktop.interface font-name 'UbuntuSans Nerd Font 11' -# --- Install user config defaults --- - -log "Installing user config defaults to ~/.config/..." -if [[ -d "$USER_DEFAULTS" ]]; then - # Each subdirectory in user-defaults/ corresponds to a ~/.config/ directory. - # Files are only copied if they don't exist yet (no overwriting). - for src_dir in "$USER_DEFAULTS"/*/; do - app_name="$(basename "$src_dir")" - dest_dir="$HOME/.config/$app_name" - mkdir -p "$dest_dir" - find "$src_dir" -type f -print0 | while IFS= read -r -d '' src_file; do - rel_path="${src_file#"$src_dir"}" - dest_file="$dest_dir/$rel_path" - if [[ ! -f "$dest_file" ]]; then - mkdir -p "$(dirname "$dest_file")" - cp "$src_file" "$dest_file" - log " + $app_name/$rel_path" - else - log " ~ $app_name/$rel_path already exists, skipped." - fi - done - done -else - err "USER_DEFAULTS not found: $USER_DEFAULTS — skipping user config defaults." -fi - # --- Zsh user config --- if [[ ! -f "$HOME/.zshrc" ]]; then diff --git a/scripts/transform.sh b/scripts/transform.sh index 4b62122..edca7c0 100755 --- a/scripts/transform.sh +++ b/scripts/transform.sh @@ -314,23 +314,6 @@ log "Deploying moonarch config overrides..." cp /usr/share/moonarch/walker-config.toml "$HOME/.config/walker/config.toml" log " + walker/config.toml" -# Deploy user defaults (overwrite, no existence check) -log "Deploying user config defaults to ~/.config/ (overwrite)..." -if [[ -d "$USER_DEFAULTS" ]]; then - for src_dir in "$USER_DEFAULTS"/*/; do - app_name="$(basename "$src_dir")" - dest_dir="$HOME/.config/$app_name" - mkdir -p "$dest_dir" - find "$src_dir" -type f -print0 | while IFS= read -r -d '' src_file; do - rel_path="${src_file#"$src_dir"}" - dest_file="$dest_dir/$rel_path" - mkdir -p "$(dirname "$dest_file")" - cp "$src_file" "$dest_file" - log " + $app_name/$rel_path" - done - done -fi - # Zsh: always create a fresh .zshrc that sources Moonarch defaults log "Creating ~/.zshrc with Moonarch defaults..." mkdir -p "$HOME/.zshrc.d"