From 80012730f3bfa9380b85b98b355d97676b7f83cb Mon Sep 17 00:00:00 2001 From: zphinx Date: Wed, 15 Apr 2026 21:20:28 +0200 Subject: [PATCH] update settings --- .config/waybar/config.jsonc | 8 +-- .config/waybar/scripts/mem-swap.sh | 53 ++++++++++++++++++ .config/waybar/style.css | 90 +++++++++++++++++++++++++++--- 3 files changed, 137 insertions(+), 14 deletions(-) create mode 100755 .config/waybar/scripts/mem-swap.sh diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index 2ef1307..401b7c0 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -17,7 +17,6 @@ "custom/mount-data", "custom/mount-usb1", "cpu", - "memory", "tray" ], "hyprland/workspaces": { @@ -46,11 +45,10 @@ }, "cpu": { "format": " {usage}%", - "tooltip": false - }, - "memory": { - "format": " {}%" + "tooltip": false, + "on-click": "alacritty -e btop" }, + "custom/mount-data": { "exec": "$HOME/.config/waybar/scripts/check-mount.sh /mnt/data data", "return-type": "json", diff --git a/.config/waybar/scripts/mem-swap.sh b/.config/waybar/scripts/mem-swap.sh new file mode 100755 index 0000000..4ce9787 --- /dev/null +++ b/.config/waybar/scripts/mem-swap.sh @@ -0,0 +1,53 @@ +#!/usr/bin/bash + +set -euo pipefail + +mode="${1:-status}" + +read -r mem_total mem_used swap_total swap_used < 0) printf "%.1f", (used/total)*100; else print "0.0" }')" + +if [[ "$swap_total" -gt 0 ]]; then + swap_used_h="$(format_bytes "$swap_used")" + swap_total_h="$(format_bytes "$swap_total")" + swap_pct="$(awk -v used="$swap_used" -v total="$swap_total" 'BEGIN { if (total > 0) printf "%.1f", (used/total)*100; else print "0.0" }')" +else + swap_used_h="0.0B" + swap_total_h="0.0B" + swap_pct="0.0" +fi + +case "$mode" in + ram) + notify-send "RAM usage" "${mem_used_h} / ${mem_total_h} (${mem_pct}%)" + ;; + swap) + if [[ "$swap_total" -gt 0 ]]; then + notify-send "Swap usage" "${swap_used_h} / ${swap_total_h} (${swap_pct}%)" + else + notify-send "Swap usage" "Swap is disabled" + fi + ;; + status) + if [[ "$swap_total" -gt 0 ]]; then + tooltip="Left click: RAM (${mem_used_h}/${mem_total_h}, ${mem_pct}%)\nRight click: Swap (${swap_used_h}/${swap_total_h}, ${swap_pct}%)" + else + tooltip="Left click: RAM (${mem_used_h}/${mem_total_h}, ${mem_pct}%)\nRight click: Swap (disabled)" + fi + + printf '{"text":"","tooltip":"%s"}\n' "$tooltip" + ;; +esac diff --git a/.config/waybar/style.css b/.config/waybar/style.css index a80a778..6cf9cc2 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -1,37 +1,109 @@ -@import url("/etc/xdg/waybar/style.css"); +* { + border: none; + border-radius: 8px; + font-family: "SauceCodePro Nerd Font", "SauceCodePro Nerd Font Mono", "Symbols Nerd Font Mono", "Symbols Nerd Font", "Font Awesome 7 Free", sans-serif; + font-size: 14px; + min-height: 0; +} +window#waybar { + background: alpha(#2e3440, 0.92); + color: #eceff4; + border-bottom: 2px solid alpha(#5e81ac, 0.55); +} + +tooltip { + background: #3b4252; + color: #eceff4; + border: 1px solid #4c566a; +} + +#workspaces { + background: alpha(#3b4252, 0.88); + padding: 2px 6px; +} + +#workspaces button { + color: #d8dee9; + background: transparent; + padding: 2px 10px; + margin: 0 2px; +} + +#workspaces button:hover { + background: alpha(#4c566a, 0.55); +} + +#workspaces button.active { + color: #2e3440; + background: #88c0d0; +} + +#workspaces button.urgent { + color: #eceff4; + background: #bf616a; +} + +#window, +#clock, #custom-screenshot, #idle_inhibitor, #pulseaudio, #network, -#clock, #cpu, #memory, #tray, #custom-mount-data, #custom-mount-usb1 { - font-family: "SauceCodePro Nerd Font", "SauceCodePro Nerd Font Mono", "Symbols Nerd Font Mono", "Symbols Nerd Font", "Font Awesome 7 Free", sans-serif; + background: alpha(#3b4252, 0.88); + color: #eceff4; + padding: 0 10px; + margin: 4px 3px; } -#custom-screenshot { - padding: 0 10px; +#clock { + background: alpha(#5e81ac, 0.35); +} + +#cpu, +#memory { + background: alpha(#81a1c1, 0.25); +} + +#network { + background: alpha(#88c0d0, 0.22); +} + +#network.disconnected { + color: #bf616a; + background: alpha(#bf616a, 0.18); +} + +#pulseaudio.muted { + color: #ebcb8b; +} + +#idle_inhibitor.activated { + color: #a3be8c; +} + +#idle_inhibitor.deactivated { + color: #bf616a; } #custom-mount-data, #custom-mount-usb1 { - padding: 0 10px; - border-radius: 6px; font-weight: 600; } #custom-mount-data.mounted, #custom-mount-usb1.mounted { color: #a3be8c; - background: rgba(163, 190, 140, 0.12); + background: alpha(#a3be8c, 0.12); } #custom-mount-data.unmounted, #custom-mount-usb1.unmounted { color: #bf616a; - background: rgba(191, 97, 106, 0.14); + background: alpha(#bf616a, 0.16); }