feat: make waybar setup a little more perfect

This commit is contained in:
Ahwx 2025-03-31 17:34:56 +02:00
parent 76406ed0cf
commit 82f4faadad

View file

@ -1,8 +1,13 @@
{ config, lib, pkgs, username, ... }: {
config,
lib,
pkgs,
username,
...
}:
{ {
imports = imports = [ (import ./scripts.nix) ];
[(import ./scripts.nix)];
programs.waybar = { programs.waybar = {
enable = true; enable = true;
@ -20,14 +25,17 @@
[{ [{
"layer": "top", "layer": "top",
"position": "top", "position": "top",
"modules-left": [ "modules-left": [
"sway/workspaces",
"hyprland/workspaces",
"privacy", "privacy",
"group/network", "group/network",
"tray", "tray",
], ],
"modules-center": [
"hyprland/workspaces",
],
"modules-right": [ "modules-right": [
"custom/yubikey#icon", "custom/yubikey#icon",
"custom/yubikey#data", "custom/yubikey#data",
@ -37,27 +45,29 @@
// "wireplumber", // "wireplumber",
"group/audio", "group/audio",
"battery", "battery",
"custom/notification",
"group/clock" "group/clock"
], ],
"hyprland/window": {
// ------------------------------------------------------------------------- "format": "{}",
// modules-left "rewrite": {
// ------------------------------------------------------------------------- "(.*) - zsh": "> [$1]"
},
"separate-outputs": true
},
"sway/workspaces": { "sway/workspaces": {
"all-outputs": true, "all-outputs": true,
"disable-scroll": true, "disable-scroll": true,
"format": "{name}" "format": "{name}"
}, },
"hyprland/workspaces": { "hyprland/workspaces": {
"all-outputs": true, "all-outputs": true,
"disable-scroll": true, "disable-scroll": true,
"format": "{name}" "format": "{name}"
}, },
"group/network": { "group/network": {
"orientation": "horizontal", "orientation": "horizontal",
"modules": [ "modules": [
@ -94,7 +104,7 @@
// "on-click-right": "/usr/local/bin/get-public-ip-info", // "on-click-right": "/usr/local/bin/get-public-ip-info",
// "interval": 30 // "interval": 30
// }, // },
"privacy": { "privacy": {
"icon-spacing": 8, "icon-spacing": 8,
"icon-size": 14, "icon-size": 14,
@ -117,31 +127,27 @@
} }
] ]
}, },
"tray": { "tray": {
"icon-size": 12, "icon-size": 12,
"spacing": 0 "spacing": 0
}, },
"sway/mode": { "sway/mode": {
"format": " {}", "format": " {}",
"tooltip": false "tooltip": false
}, },
// -------------------------------------------------------------------------
// modules-right
// -------------------------------------------------------------------------
"custom/yubikey#icon": { "custom/yubikey#icon": {
"exec": "~/.local/bin/waybar-yubikey 0", "exec": "~/.local/bin/waybar-yubikey 0",
"return-type": "json" "return-type": "json"
}, },
"custom/yubikey#data": { "custom/yubikey#data": {
"exec": "~/.local/bin/waybar-yubikey 1", "exec": "~/.local/bin/waybar-yubikey 1",
"return-type": "json" "return-type": "json"
}, },
"group/hardware": { "group/hardware": {
"orientation": "horizontal", "orientation": "horizontal",
"modules": [ "modules": [
@ -156,7 +162,7 @@
"transition-duration": 500 "transition-duration": 500
} }
}, },
"cpu": { "cpu": {
"interval": 30, "interval": 30,
"format": " {avg_frequency:3.2f}GHz <span color='#aaaaaa'>{usage}%</span>", "format": " {avg_frequency:3.2f}GHz <span color='#aaaaaa'>{usage}%</span>",
@ -165,31 +171,31 @@
"critical": 90 "critical": 90
}, },
}, },
"temperature#cpu": { "temperature#cpu": {
"hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon5/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
"format": " CPU <span color='#aaaaaa'>{temperatureC}°C</span>" "format": " CPU <span color='#aaaaaa'>{temperatureC}°C</span>"
}, },
"temperature#gpu": { "temperature#gpu": {
"hwmon-path": "/sys/class/hwmon/hwmon0/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon0/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
"format": "· GPU <span color='#aaaaaa'>{temperatureC}°C</span>" "format": "· GPU <span color='#aaaaaa'>{temperatureC}°C</span>"
}, },
"temperature#nvme": { "temperature#nvme": {
"hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon1/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
"format": "· NVMe <span color='#aaaaaa'>{temperatureC}°C</span>" "format": "· NVMe <span color='#aaaaaa'>{temperatureC}°C</span>"
}, },
"temperature#wifi": { "temperature#wifi": {
"hwmon-path": "/sys/class/hwmon/hwmon11/temp1_input", "hwmon-path": "/sys/class/hwmon/hwmon11/temp1_input",
"critical-threshold": 80, "critical-threshold": 80,
"format": "· WiFi <span color='#aaaaaa'>{temperatureC}°C</span>" "format": "· WiFi <span color='#aaaaaa'>{temperatureC}°C</span>"
}, },
"group/resources": { "group/resources": {
"orientation": "horizontal", "orientation": "horizontal",
"modules": [ "memory", "disk#root" ], "modules": [ "memory", "disk#root" ],
@ -198,18 +204,18 @@
"transition-duration": 500 "transition-duration": 500
} }
}, },
"memory": { "memory": {
"interval": 60, "interval": 60,
"format": "󰘚 {used:3.1f}GiB/<span color='#aaaaaa'>{total:3.1f}GiB</span>" "format": "󰘚 {used:3.1f}GiB/<span color='#aaaaaa'>{total:3.1f}GiB</span>"
}, },
"disk#root": { "disk#root": {
"interval": 360, "interval": 360,
"format": " {used}/<span color='#aaaaaa'>{total}</span>", "format": " {used}/<span color='#aaaaaa'>{total}</span>",
"path": "/" "path": "/"
}, },
"bluetooth": { "bluetooth": {
// "controller": "controller1", // "controller": "controller1",
"on-click": "~/.local/bin/waybar-bluetooth toggle", "on-click": "~/.local/bin/waybar-bluetooth toggle",
@ -223,7 +229,7 @@
"tooltip-format-enumerate-connected": "{device_alias}\t\t[{device_address}]", "tooltip-format-enumerate-connected": "{device_alias}\t\t[{device_address}]",
"tooltip-format-enumerate-connected-battery": "{device_alias} ({device_battery_percentage})\t\t[{device_address}]" "tooltip-format-enumerate-connected-battery": "{device_alias} ({device_battery_percentage})\t\t[{device_address}]"
}, },
"group/audio": { "group/audio": {
"orientation": "horizontal", "orientation": "horizontal",
"modules": [ "modules": [
@ -237,7 +243,7 @@
"transition-duration": 500 "transition-duration": 500
} }
}, },
"wireplumber": { "wireplumber": {
"format": "{icon} {node_name}/<span color='#aaaaaa'>{volume}</span>", "format": "{icon} {node_name}/<span color='#aaaaaa'>{volume}</span>",
"format-muted": "", "format-muted": "",
@ -245,21 +251,21 @@
"on-click-right": "helvum", "on-click-right": "helvum",
"format-icons": ["", "", ""] "format-icons": ["", "", ""]
}, },
"custom/audio-internal": { "custom/audio-internal": {
"format": "󱡬 ", "format": "󱡬 ",
"tooltip-format": "Internal", "tooltip-format": "Internal",
"on-click": "audio-router analog", "on-click": "audio-router analog",
"interval": "once" "interval": "once"
}, },
"custom/audio-hdmi": { "custom/audio-hdmi": {
"format": "󰡁 ", "format": "󰡁 ",
"tooltip-format": "HDMI", "tooltip-format": "HDMI",
"on-click": "audio-router hdmi", "on-click": "audio-router hdmi",
"interval": "once" "interval": "once"
}, },
"battery": { "battery": {
"bat": "BAT1", "bat": "BAT1",
"interval": 30, "interval": 30,
@ -277,28 +283,7 @@
"format-not-charging": "󱐤 <span color='#aaaaaa'>{capacity}%</span>", "format-not-charging": "󱐤 <span color='#aaaaaa'>{capacity}%</span>",
"format-icons": [" ", " ", " ", " ", " "], "format-icons": [" ", " ", " ", " ", " "],
}, },
"custom/notification": {
"tooltip": false,
"format": "{icon} ",
"format-icons": {
"notification": "",
"none": "",
"dnd-notification": "",
"dnd-none": "",
"inhibited-notification": "",
"inhibited-none": "",
"dnd-inhibited-notification": "",
"dnd-inhibited-none": ""
},
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"on-click": "swaync-client -t -sw",
"on-click-right": "swaync-client -d -sw",
"escape": true
},
"group/clock": { "group/clock": {
"orientation": "horizontal", "orientation": "horizontal",
"modules": [ "custom/clock#minutes", "clock#time", "clock#date" ], "modules": [ "custom/clock#minutes", "clock#time", "clock#date" ],
@ -307,7 +292,7 @@
"transition-duration": 500 "transition-duration": 500
} }
}, },
"clock#date": { "clock#date": {
"interval": 60, "interval": 60,
"format": " <span color='#ffffff'> {:%a %e %b %Y}</span>", "format": " <span color='#ffffff'> {:%a %e %b %Y}</span>",
@ -331,7 +316,7 @@
"on-scroll-down": "shift_down" "on-scroll-down": "shift_down"
} }
}, },
"clock#time": { "clock#time": {
"interval": 60, "interval": 60,
"format": " {:%I:%M %p}", "format": " {:%I:%M %p}",
@ -361,32 +346,33 @@
min-height: 26px; min-height: 26px;
/* margin: 0 0px; */ /* margin: 0 0px; */
} }
window#waybar.top { window#waybar.top {
background-color: rgba(115, 116, 116, 0.22); /* background-color: rgba(115, 116, 116, 0.22); */
background-color: rgba(0, 0, 0, 0.75);
border-bottom: none; border-bottom: none;
color: #eeeeee; color: #eeeeee;
transition-property: background-color; transition-property: background-color;
transition-duration: .5s; transition-duration: .5s;
} }
window#waybar.hidden { window#waybar.hidden {
opacity: 0.5; opacity: 0.5;
} }
label#window { label#window {
text-shadow: 0px 0px 3px #18181e; text-shadow: 0px 0px 3px #18181e;
} }
tooltip { tooltip {
background: rgba(43, 48, 59, 0.5); background: rgba(43, 48, 59, 0.5);
border: 1px solid rgba(100, 114, 125, 0.5); border: 1px solid rgba(100, 114, 125, 0.5);
} }
tooltip label { tooltip label {
color: white; color: white;
} }
.modules-left > widget > label, .modules-left > widget > label,
.modules-left > box > widget > label, .modules-left > box > widget > label,
.modules-right > widget > label, .modules-right > widget > label,
@ -394,15 +380,15 @@
padding: 0 10px; padding: 0 10px;
margin: 0px 0px 0px 10px; margin: 0px 0px 0px 10px;
} }
#network, #resources, #audio, #clock { #network, #resources, #audio, #clock {
padding: 0 4px; padding: 0 4px;
} }
.drawer-child > label { .drawer-child > label {
margin: 0px 10px; margin: 0px 10px;
} }
#custom-audio-internal, #custom-audio-internal,
#custom-audio-motu, #custom-audio-motu,
#custom-audio-headphones, #custom-audio-headphones,
@ -411,11 +397,11 @@
padding: 4px 2px; padding: 4px 2px;
border-radius: 0px; border-radius: 0px;
} }
#workspaces { #workspaces {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
} }
#workspaces button { #workspaces button {
/*padding: 4px 6px;*/ /*padding: 4px 6px;*/
padding: 4px 6px; padding: 4px 6px;
@ -423,61 +409,62 @@
border-radius: 0px; border-radius: 0px;
/*min-width: 32px;*/ /*min-width: 32px;*/
} }
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover { #workspaces button:hover {
box-shadow: inherit; box-shadow: inherit;
text-shadow: inherit; text-shadow: inherit;
background: transparent; background: transparent;
color: #ffffff; color: #ffffff;
} }
#workspaces button.active {
box-shadow: inherit;
text-shadow: inherit;
background: transparent;
color: #ffffff;
}
#workspaces button.focused { #workspaces button.focused {
color: #eeeeee; color: #eeeeee;
} }
#workspaces button.focused:hover { #workspaces button.focused:hover {
color: #ffffff; color: #ffffff;
} }
#workspaces button.urgent { #workspaces button.urgent {
color: #ffffff; color: #ffffff;
background-color: #e27878; background-color: #e27878;
} }
#language { #language {
/* margin: 0px 0px 0px 0px; */ /* margin: 0px 0px 0px 0px; */
color: #cccccc; color: #cccccc;
} }
#tray { #tray {
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
/* margin-left: 10px; */ /* margin-left: 10px; */
} }
#tray image { #tray image {
margin: 0px 10px 0px 0px; margin: 0px 10px 0px 0px;
} }
#mode { #mode {
background-color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);
border: 2px solid #e2a478; border: 2px solid #e2a478;
margin: 0px 10px 0px 0px; margin: 0px 10px 0px 0px;
border-radius: 5px; border-radius: 5px;
} }
#custom-yubikey.icon { #custom-yubikey.icon {
background: #f9409d; background: #f9409d;
} }
#custom-notification {
padding: 0;
color: #ffffff;
margin: 0px 10px;
}
''; '';
}; };
}; };
} }