feat: Waybar improvements and refactoring (multiple changes)

This commit is contained in:
2025-09-22 22:37:55 +02:00
parent 8c9fcbbbf4
commit 9e5c90fcb6
8 changed files with 83 additions and 56 deletions

View File

@@ -8,7 +8,7 @@
"passthrough": false,
"fixed-center": true,
"height": 32,
"spacing": 8,
"spacing": 0,
// Hyprland
"hyprland/workspaces": {
"icon-size": 26,
@@ -91,7 +91,7 @@
"tooltip": true,
"on-click": "pavucontrol",
"on-click-right": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
"on-click-middle": "bash -lc \"next=$(pactl list short sinks | awk '{print \\$1}' | awk -v cur=$(pactl get-default-sink) '\\$0!=cur{print; exit}'); if [ -n \\\"$next\\\" ]; then pactl set-default-sink $next; notify-send -a waybar 'Audio' 'Switched default sink to '$next; fi\"",
"on-click-middle": "$HOME/.config/waybar/scripts/cycle_sinks.sh",
"format-icons": {
"alsa_output.usb-SteelSeries_Arctis_7_-00.analog-stereo": "",
"alsa_output.pci-0000_0a_00.4.iec958-stereo": "",
@@ -147,12 +147,14 @@
"on-click": "pkill -SIGRTMIN+4 waybar",
},
"custom/temps": {
"exec-if": "command -v sensors >/dev/null",
"exec": "bash -lc \"sensors | awk '/Tctl|Tdie|Package id 0/{gsub(/\\+|°C/,\\\"\\\"); print int($2); exit}'\"",
"exec-if": "[ -x $HOME/.config/waybar/scripts/temps.sh ]",
"exec": "$HOME/.config/waybar/scripts/temps.sh",
"interval": 5,
"format": " {output}°C",
"format": " {}°C",
"tooltip": true,
"on-click": "alacritty -e watch -n 1 sensors",
"signal": 6,
"on-click": "pkill -SIGRTMIN+6 waybar",
"on-click-right": "alacritty -e watch -n 1 sensors"
},
"custom/hyprsysteminfo": {
"exec-if": "[ -x $HOME/.config/waybar/scripts/hyprsysteminfo.sh ]",
@@ -160,7 +162,9 @@
"return-type": "json",
"interval": 5,
"tooltip": true,
"on-click": "bash -lc 'command -v hyprsysteminfo >/dev/null && uwsm app -- hyprsysteminfo'",
"signal": 7,
"on-click": "pkill -SIGRTMIN+7 waybar",
"on-click-right": "bash -lc 'command -v hyprsysteminfo >/dev/null && uwsm app -- hyprsysteminfo'"
},
"custom/hyprsunset": {
"exec-if": "[ -x $HOME/.config/waybar/scripts/hyprsunset_toggle.sh ]",
@@ -175,8 +179,14 @@
// Right click: manual on/off (doesnt touch auto flag)
"on-click-right": "bash -lc '$HOME/.config/waybar/scripts/hyprsunset_toggle.sh --toggle && pkill -SIGRTMIN+5 waybar'",
// Scroll: fine tune manual temp (useful when AUTO is OFF)
"on-scroll-up": "bash -lc 't=$($HOME/.config/waybar/scripts/hyprsunset_toggle.sh --print | sed -n \"s/.* \\([0-9]\\+\\)K.*/\\1/p\"); [ -z \"$t\" ] && t=3800; t=$((t+200)); $HOME/.config/waybar/scripts/hyprsunset_toggle.sh --set $t && pkill -SIGRTMIN+5 waybar'",
"on-scroll-down": "bash -lc 't=$($HOME/.config/waybar/scripts/hyprsunset_toggle.sh --print | sed -n \"s/.* \\([0-9]\\+\\)K.*/\\1/p\"); [ -z \"$t\" ] && t=3800; t=$((t-200)); if [ $t -lt 1000 ]; then t=1000; fi; $HOME/.config/waybar/scripts/hyprsunset_toggle.sh --set $t && pkill -SIGRTMIN+5 waybar'",
"on-scroll-up": "$HOME/.config/waybar/scripts/hyprsunset_toggle.sh --increase && pkill -SIGRTMIN+5 waybar",
"on-scroll-down": "$HOME/.config/waybar/scripts/hyprsunset_toggle.sh --decrease && pkill -SIGRTMIN+5 waybar",
},
"custom/updates": {
"exec": "$HOME/.config/waybar/scripts/updates.sh",
"return-type": "json",
"interval": 3600,
"on-click": "alacritty -e sudo pacman -Syu"
},
// Tray / Clock / Privacy
"tray": {

View File

@@ -1,20 +1,18 @@
{
"name": "bar-dp1",
"output": "DP-1",
"spacing": 8,
"modules-left": ["hyprland/workspaces", "hyprland/window"],
"modules-center": ["privacy", "mpris"],
"spacing": 0,
"modules-left": ["hyprland/workspaces", "privacy", "hyprland/window"],
"modules-center": ["clock"],
"modules-right": [
"group/sys",
"custom/updates",
"custom/alhp",
"network",
"pulseaudio",
"bluetooth",
"battery",
"power-profiles-daemon",
"custom/hyprsysteminfo",
"custom/hyprsunset",
"tray",
"clock",
"tray"
],
"hyprland/window": {
"max-length": 60,

View File

@@ -1,26 +1,25 @@
{
"name": "bar-dp2",
"output": "DP-2",
"spacing": 10,
"modules-left": ["hyprland/workspaces", "hyprland/window"],
"modules-center": ["privacy", "mpris"],
"spacing": 0,
"modules-left": ["hyprland/workspaces", "privacy", "hyprland/window"],
"modules-center": ["clock"],
"modules-right": [
"cpu",
"memory",
"disk#nvme0",
"disk#nvme1",
"custom/temps",
"custom/updates",
"custom/alhp",
"network",
"pulseaudio",
"bluetooth",
"battery",
"power-profiles-daemon",
"custom/alhp",
"custom/razer-mouse-battery",
"custom/temps",
"custom/hyprsysteminfo",
"custom/hyprsunset",
"tray",
"clock",
"tray"
],
"hyprland/window": {
"max-length": 80,

View File

@@ -2,18 +2,15 @@
"name": "bar-hdmi",
"output": "HDMI-A-1",
"height": 28,
"spacing": 6,
"modules-left": ["hyprland/workspaces", "hyprland/window"],
"modules-center": ["privacy", "mpris"],
"spacing": 0,
"modules-left": ["hyprland/workspaces", "privacy", "hyprland/window"],
"modules-center": ["clock"],
"modules-right": [
"custom/updates",
"custom/alhp",
"network",
"pulseaudio",
"bluetooth",
"battery",
"custom/hyprsysteminfo",
"custom/hyprsunset",
"tray",
"clock",
"tray"
],
"hyprland/workspaces": {
"icon-size": 22,

View File

@@ -45,7 +45,7 @@ esac
# Emit compact JSON for Statusbar
jq -nc \
--arg text "<span color=\"#4F84CC\">$icon</span> <span color=\"#CAD3E8\">$text</span>" \
--arg text "<span color=\"#FFFFFF\">$icon</span> <span color=\"#FFFFFF\">$text</span>" \
--arg class "$class" \
--arg tooltip "$tooltip" \
'{text: $text, class: $class, tooltip: $tooltip}'

View File

@@ -53,6 +53,21 @@ print_json() {
fi
}
increase_temp() {
local t="$(cur_temp)"
[ -z "$t" ] && t=3800
t=$((t+200))
set_temp "$t"
}
decrease_temp() {
local t="$(cur_temp)"
[ -z "$t" ] && t=3800
t=$((t-200))
if [ "$t" -lt 1000 ]; then t=1000; fi
set_temp "$t"
}
case "${1:---print}" in
--print) print_json ;;
--auto-on) echo -n "1" > "$AUTO_FILE" ; print_json ;;
@@ -84,6 +99,14 @@ case "${1:---print}" in
set_temp "$t"
print_json
;;
*) echo "Usage: $0 [--print|--toggle-auto|--auto-on|--auto-off|--toggle|--set TEMP]" >&2; exit 1 ;;
--increase)
increase_temp
print_json
;;
--decrease)
decrease_temp
print_json
;;
*) echo "Usage: $0 [--print|--toggle-auto|--auto-on|--auto-off|--toggle|--set TEMP|--increase|--decrease]" >&2; exit 1 ;;
esac

View File

@@ -26,7 +26,7 @@
/* Bar Background */
window#waybar {
background: @bg_main;
background: linear-gradient(90deg, @bg_main, rgba(21, 37, 53, 0.85));
border-top: 1px solid @border_main;
}
@@ -52,16 +52,14 @@ tooltip {
/* Module Spacing & Hover */
.module {
padding: 0 6px;
margin: 0 2px;
margin: 0;
}
.module:hover {
background: @bg_hover;
transition: background-color 0.3s ease;
}
/* HDMI: tighter modules to free center space */
window#waybar.bar-hdmi .module {
padding: 0 4px;
}
/* Collapse empty/noise modules */
#mpris.empty,
@@ -80,11 +78,15 @@ window#waybar.bar-hdmi .module {
#network,
#pulseaudio,
#bluetooth,
#battery,
#power-profiles-daemon,
#custom-alhp,
#custom-razer-mouse-battery,
#custom-hyprsunset {
/* ← new module gets a separator too */
#custom-temps,
#custom-hyprsysteminfo,
#custom-hyprsunset,
#custom-updates,
#tray {
border-right: 1px solid @border_main;
}
@@ -93,7 +95,7 @@ window#waybar.bar-hdmi .module {
margin: 0 2px;
}
#workspaces button {
padding: 4px 6px;
min-width: 30px;
color: @content_inactive;
}
#workspaces button:hover {
@@ -114,19 +116,19 @@ window#waybar.bar-hdmi .module {
#window {
min-width: 0;
font-weight: 500;
padding: 0 6px;
}
/* MPRIS */
#mpris {
min-width: 0;
padding: 0 6px;
}
/* Tray & Clock */
#tray,
#clock {
padding: 0 6px;
}
#privacy {
min-width: 30px;
}
#tray > .passive {
opacity: 0.7;
@@ -153,16 +155,15 @@ window#waybar.bar-hdmi .module {
#bluetooth,
#mpris,
#custom-hyprsunset {
color: #dee6f7; /* very light tint; still reads as white on dark */
color: #FFFFFF; /* very light tint; still reads as white on dark */
}
/* Drawer polish (DP-1) */
#custom-sys {
padding: 0 8px;
min-width: 30px;
font-weight: 600;
}
.sys {
padding: 0 6px;
}
.revealed .sys {
background: rgba(79, 132, 204, 0.12);
@@ -172,7 +173,6 @@ window#waybar.bar-hdmi .module {
#custom-alhp,
#custom-razer-mouse-battery,
#custom-hyprsunset {
padding: 0 6px;
}
/* Network states */
@@ -186,6 +186,6 @@ window#waybar.bar-hdmi .module {
#temperature.critical { color: #FFCC33; font-weight: 600; }
/* Backlight spacing */
#backlight { padding: 0 6px; border-right: 1px solid @border_main; }
#custom-mic, #custom-touchpad { padding: 0 6px; }
#backlight { border-right: 1px solid @border_main; }
#custom-mic, #custom-touchpad { }