From bf506d6efcfd355742a8555b2ab3d04741f867b8 Mon Sep 17 00:00:00 2001 From: unexplrd Date: Mon, 28 Jul 2025 17:16:42 +0300 Subject: [PATCH] another day another tweaking of waybar Signed-off-by: unexplrd --- .../desktop/niri/programs/waybar/default.nix | 332 +++++------------- 1 file changed, 88 insertions(+), 244 deletions(-) diff --git a/modules/home/desktop/niri/programs/waybar/default.nix b/modules/home/desktop/niri/programs/waybar/default.nix index f3a51e6..2298e79 100644 --- a/modules/home/desktop/niri/programs/waybar/default.nix +++ b/modules/home/desktop/niri/programs/waybar/default.nix @@ -6,8 +6,6 @@ launcher, ... }: let - inherit (config.lib.stylix) colors; - ifLaptop = lib.mkIf (osConfig.networking.hostName != "dunamis"); in { enable = true; @@ -19,15 +17,15 @@ in { position = "bottom"; height = 33; spacing = 0; - # margin-left = 36 + 3; - # margin-right = 36 + 3; - # margin-bottom = 3; + margin-left = 36 + 3; + margin-right = 36 + 3; + margin-bottom = 3; modules-left = [ "custom/launcher" "wlr/taskbar" - # "privacy" ]; modules-right = [ + "clock" "niri/workspaces" "niri/language" ]; @@ -39,133 +37,17 @@ in { format-en = "🇺🇸"; format-uk = "🇺🇦"; }; - "group/laptop" = { - orientation = "inherit"; - modules = [ - "backlight" - "battery" - "power-profiles-daemon" - ]; - }; - backlight = { - format = "{percent}% {icon}"; - format-icons = [ - "󰃚" - "󰃛" - "󰃜" - "󰃝" - "󰃞" - "󰃟" - "󰃠" - ]; - }; - idle_inhibitor = { - format = "{icon}"; - format-icons = { - activated = "󰅶"; - deactivated = "󰾪"; - }; - }; - tray = { - icon-size = 16; - spacing = 6; - }; clock = { - interval = 1; format = "{:%R}"; + interval = 1; tooltip = true; tooltip-format = "{:%B %d, %A}"; }; - battery = { - states = { - good = 95; - warning = 30; - critical = 15; - }; - format = "{capacity}% {icon}"; - format-full = "{capacity}% 󱟢"; - format-charging = "{capacity}% 󰂄"; - format-plugged = "{capacity}% 󰚥"; - format-alt = "{icon} {time}"; - format-icons = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; - }; - memory = { - format = "{used:0.1f}G "; - tooltip-format = '' - RAM: {used:0.1f}G/{total:0.1f}G ({percentage}%) - Swap: {swapUsed:0.1f}G/{swapTotal:0.1f}G ({swapPercentage}%)''; - }; - network = { - format = "{bandwidthDownBits} 󰇚 | {bandwidthUpBits} 󰕒"; - interval = 3; - tooltip = false; - }; - cpu = { - format = "{usage}% 󰍛"; - interval = 3; - }; - upower = { - icon-size = 16; - format = "{percentage}"; - hide-if-empty = true; - tooltip = true; - tooltip-spacing = 20; - }; - power-profiles-daemon = { - format = "{icon}"; - tooltip-format = "Power profile: {profile}\nDriver: {driver}"; - tooltip = true; - format-icons = { - default = "󱡮"; - performance = "󱡮"; - balanced = ""; - power-saver = ""; - }; - }; - wireplumber = { - scroll-step = 3; - format = "{volume}% {icon}"; - format-muted = "󰖁"; - format-icons = ["󰕿" "󰖀" "󰕾"]; - on-click = lib.getExe pkgs.pwvucontrol; - on-click-right = "wpctl set-mute @DEFAULT_SINK@ toggle"; - }; "custom/launcher" = { format = ""; on-click = launcher; tooltip = false; }; - "custom/notification" = { - tooltip = false; - format = "{icon}"; - format-icons = { - notification = "󱅫"; - none = "󰂚"; - dnd-notification = "󰂛"; - dnd-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; - }; - "privacy" = { - icon-spacing = 0; - icon-size = 16; - transition-duration = 250; - screenshare = { - type = "screenshare"; - tooltip = true; - tooltip-icon-size = 24; - }; - audio-in = { - type = "audio-in"; - tooltip = true; - tooltip-icon-size = 24; - }; - }; "wlr/taskbar" = { format = "{icon} {name}"; icon-size = 16; @@ -178,32 +60,22 @@ in { position = "top"; height = 33; spacing = 0; - # margin-left = 36 + 3; - # margin-right = 36 + 3; - # margin-top = 3; + margin-left = 36 + 3; + margin-right = 36 + 3; + margin-top = 3; modules-left = [ "custom/notification" "tray" - ]; - modules-center = ["clock"]; - modules-right = [ "privacy" + ]; + modules-right = [ "network" "cpu" "memory" "wireplumber" (ifLaptop "group/laptop") - # "tray" "idle_inhibitor" ]; - "niri/workspaces" = { - format = "{index}"; - }; - "niri/language" = { - format = "{}"; - format-en = "🇺🇸"; - format-uk = "🇺🇦"; - }; "group/laptop" = { orientation = "inherit"; modules = [ @@ -225,6 +97,7 @@ in { ]; }; idle_inhibitor = { + tooltip = false; format = "{icon}"; format-icons = { activated = "󰅶"; @@ -235,12 +108,6 @@ in { icon-size = 16; spacing = 6; }; - clock = { - interval = 1; - format = "{:%R}"; - tooltip = true; - tooltip-format = "{:%B %d, %A}"; - }; battery = { states = { good = 95; @@ -269,17 +136,10 @@ in { format = "{usage}% 󰍛"; interval = 3; }; - upower = { - icon-size = 16; - format = "{percentage}"; - hide-if-empty = true; - tooltip = true; - tooltip-spacing = 20; - }; power-profiles-daemon = { format = "{icon}"; - tooltip-format = "Power profile: {profile}\nDriver: {driver}"; tooltip = true; + tooltip-format = "Power profile: {profile}\nDriver: {driver}"; format-icons = { default = "󱡮"; performance = "󱡮"; @@ -295,11 +155,6 @@ in { on-click = lib.getExe pkgs.pwvucontrol; on-click-right = "wpctl set-mute @DEFAULT_SINK@ toggle"; }; - "custom/launcher" = { - format = ""; - on-click = launcher; - tooltip = false; - }; "custom/notification" = { tooltip = false; format = "{icon}"; @@ -331,54 +186,62 @@ in { tooltip-icon-size = 24; }; }; - "wlr/taskbar" = { - format = "{icon} {name}"; - icon-size = 18; - icon-theme = "${config.dconf.settings."org/gnome/desktop/interface".icon-theme}"; - tooltip-format = "{title}"; - on-click = "activate"; - }; }; # TODO: figure out magic waybar css styling (does it pick up `~/.config/gtk-3.0/gtk.css` ?) - style = + style = let + colors = config.lib.stylix.colors.withHashtag; + in # css '' - @define-color base00 #${colors.base00}; @define-color base08 #${colors.base08}; - @define-color base01 #${colors.base01}; @define-color base09 #${colors.base09}; - @define-color base02 #${colors.base02}; @define-color base0A #${colors.base0A}; - @define-color base03 #${colors.base03}; @define-color base0B #${colors.base0B}; - @define-color base04 #${colors.base04}; @define-color base0C #${colors.base0C}; - @define-color base05 #${colors.base05}; @define-color base0D #${colors.base0D}; - @define-color base06 #${colors.base06}; @define-color base0E #${colors.base0E}; - @define-color base07 #${colors.base07}; @define-color base0F #${colors.base0F}; + @define-color base00 ${colors.base00}; @define-color base08 ${colors.base08}; + @define-color base01 ${colors.base01}; @define-color base09 ${colors.base09}; + @define-color base02 ${colors.base02}; @define-color base0A ${colors.base0A}; + @define-color base03 ${colors.base03}; @define-color base0B ${colors.base0B}; + @define-color base04 ${colors.base04}; @define-color base0C ${colors.base0C}; + @define-color base05 ${colors.base05}; @define-color base0D ${colors.base0D}; + @define-color base06 ${colors.base06}; @define-color base0E ${colors.base0E}; + @define-color base07 ${colors.base07}; @define-color base0F ${colors.base0F}; * { - /* all: unset; */ font-family: Symbols Nerd Font, FontAwesome, ${config.stylix.fonts.sansSerif.name}; - font-weight: 500; font-size: 16px; + font-weight: 500; } - .modules-left, .modules-center, .modules-right, window#waybar { + .modules-left, + .modules-center, + .modules-right, + window#waybar { background-color: @base00; color: @base05; border-radius: 12px; } - window#waybar { - border-radius: 0; + .modules-left, + .modules-center, + .modules-right { + padding-left: 3px; + } /* for leftmost modules */ + + button { + border-radius: 6px; + box-shadow: inset 0 -3px transparent; } - /* for leftmost modules */ - .modules-left, .modules-center, .modules-right { - padding-left: 3px; - background-color: @base00; + button:hover { + background: inherit; + box-shadow: inset 0 -3px transparent; + } + + label:focus { + background-color: #000000; + } + + tooltip label { color: @base05; } - window#bottom.modules-center { - background-color: transparent - } + tooltip { background: @base01; border: 1px solid @base0D; @@ -386,18 +249,8 @@ in { padding: 2em; } - tooltip label { - color: @base05; - } - - button { - box-shadow: inset 0 -3px transparent; - border-radius: 6px; - } - - button:hover { - background: inherit; - box-shadow: inset 0 -3px transparent; + window#bottom.modules-center { + background-color: transparent } #backlight, @@ -415,7 +268,6 @@ in { #privacy-item, #taskbar button, #taskbar, - #tray button, #tray, #wireplumber, #workspaces button, @@ -425,7 +277,6 @@ in { background-color: @base01; margin: 3px 3px 3px 0; padding: 0 0.42em; - min-width: 1em; } #backlight, @@ -437,40 +288,21 @@ in { #wireplumber { padding: 0 0.5em; } - #custom-notification, - #power-profiles-daemon { - min-width: 1em; - } - - #privacy, - #taskbar, - #workspaces { - padding: 0; - } - - #workspaces { - padding-left: 3px; - } - - #privacy-item { - padding: 0 0.3em; - } - - #taskbar button { - padding-left: 0; - } - #taskbar button, - #tray button, - #workspaces button { - border-radius: 6px; - min-width: 0.8em; - } #battery.critical:not(.charging) { background-color: @base09; color: @base00; } + #custom-launcher, + #custom-notification, + #idle_inhibitor, + #language, + #power-profiles-daemon { + padding: 0; + min-width: 1.7em; + } + #power-profiles-daemon.performance { background-color: @base0D; color: @base00; @@ -481,6 +313,20 @@ in { color: @base00; } + #privacy, + #taskbar, + #workspaces { + padding: 0; + } + + #privacy-item, + #taskbar button, + #workspaces button { + border-radius: 6px; + min-width: 1.4em; + padding: 0; + } + #privacy-item.audio-in { background-color: @base0E; color: @base00; @@ -490,24 +336,27 @@ in { #privacy-item.screenshare { background-color: @base0C; color: @base00; - margin: 3px 0 3px 3px; + margin-right: 0; } - #taskbar button, - #tray button { + #taskbar button { + padding-left: 0; + } + + #taskbar button { padding: 0 0.4em; margin: 3px; } - #workspaces button.active, - #taskbar button.active { + #taskbar button.active, + #workspaces button.active { background-color: @base02; } - #workspaces button:hover, - #workspaces button.active:hover, #taskbar button.active:hover, - #taskbar button:hover { + #taskbar button:hover, + #workspaces button:hover, + #workspaces button.active:hover { background-color: @base0D; color: @base00; } @@ -516,22 +365,17 @@ in { background-color: transparent; } - #tray > .needs-attention { + #tray>.needs-attention { -gtk-icon-effect: highlight; background-color: @base08; } - #tray > .passive { + #tray>.passive { -gtk-icon-effect: dim; } - /* #workspaces button.active { - color: @base00; - background-color: @base0D; - } */ - - label:focus { - background-color: #000000; + #workspaces { + padding-left: 3px; } ''; }