From 6efd73e6aac5434f0b52bd64032d3ff2a277c27d Mon Sep 17 00:00:00 2001 From: Adrian Gunnar Lauterer Date: Sun, 25 May 2025 11:05:22 +0200 Subject: [PATCH] feat: add custom launcher and enhance network and clock modules with tooltips and styling --- home/gunalx/waybar.nix | 131 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 120 insertions(+), 11 deletions(-) diff --git a/home/gunalx/waybar.nix b/home/gunalx/waybar.nix index 4196e1d..3fe86ac 100644 --- a/home/gunalx/waybar.nix +++ b/home/gunalx/waybar.nix @@ -18,9 +18,9 @@ in settings = [ (builtins.fromJSON '' { - "height": 30, + "height": 36, "spacing": 2, - "modules-left": ["sway/workspaces","niri/workspaces"], + "modules-left": [ "custom/launcher", "sway/workspaces","niri/workspaces"], "modules-center": ["niri/window"], "modules-right": [ "idle_inhibitor","backlight","pulseaudio","keyboard-state", @@ -28,6 +28,11 @@ in "power-profiles-daemon","clock","tray","custom/power" ], + "custom/launcher": { + "format": "  ", + "on-click": "pkill fuzzel || fuzzel" + }, + "sway/workspaces": { "format": "{index}: {name} - {icon}", "format-icons": { @@ -74,14 +79,27 @@ in "keyboard-state": { "numlock": true, "capslock": true, - "format": "{icon}", + "format": "{icon}", "format-icons": { "locked":"","unlocked":"" } }, "network": { - "format-wifi": " {essid} ({signalStrength}%)", - "format-ethernet": " {ipaddr}", - "format-disconnected": "⚠ Disconnected" + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": " {ipaddr}", + "format-disconnected": "⚠ Disconnected", + "format-alt": " {ipaddr}/{cidr}", + "format-alt-click": "click-right", + "tooltip": true, + "tooltip-format-wifi": " WiFi\nSSID: {essid}\nInterface: {ifname}\nIP: {ipaddr}\nIPv6: {ipaddr6}\nGateway: {gwaddr}\nFrequency: {frequency} MHz\nSignal: {signalStrength}% ({signaldBm} dBm)", + +"tooltip-format-ethernet": " Ethernet\nInterface: {ifname}\nIP: {ipaddr}\nIPv6: {ipaddr6}\nGateway: {gwaddr}\nNetmask: {netmask}", + + "tooltip-format-disconnected": " No Connection\nClick to refresh network info", + + "on-click": "nmcli device wifi rescan && nmcli connection show --active", + "on-click-right": "nmcli device status", + "interval": 5, + "max-length": 50 }, "cpu": { "format": " {usage}%" }, @@ -121,17 +139,60 @@ in "clock": { "format": "{:%H:%M}", - "format-alt": "{:%Y-%m-%d}" + "format-alt": "{:%Y-%m-%d}", + "tooltip": true, + "tooltip-format": "{calendar}", + "calendar": { + "mode": "month", + "mode-mon-col": 3, + "weeks-pos": "right", + "on-scroll": 1, + "format": { + "months": "{}", + "days": "{}", + "weeks": "W{}", + "weekdays": "{}", + "today": "{}" + } + }, + "actions": { + "on-click-right": "mode", + "on-scroll-up": "shift_up", + "on-scroll-down": "shift_down" + } }, "tray": { - "spacing": 6 + "spacing": 8 }, "custom/power": { "format": "⏻", "tooltip": "exit", - "on-click": "wleave" + "on-click": "wleave"/* Tooltip styling */ +tooltip { + background-color: ${toRGBA palette.base00 "0.9"}; + border: 1px solid ${toRGBA palette.base07 "0.4"}; + border-radius: 8px; + color: ${toRGBA palette.base05 "0.9"}; + padding: 8px 12px; + font-size: 12px; +} + +tooltip label { + color: ${toRGBA palette.base05 "0.9"}; +} + +/* Calendar tooltip specific styling */ +#clock tooltip { + font-family: monospace; +} + +/* Network tooltip specific styling */ +#network tooltip { + font-family: monospace; + max-width: 300px; +} } } '') @@ -156,7 +217,7 @@ in /* Module blocks */ #idle_inhibitor,#backlight,#pulseaudio,#keyboard-state, #network,#cpu,#memory,#temperature,#battery, - #power-profiles-daemon,#clock,#tray,#custom-power,#niri-window { + #power-profiles-daemon,#clock,#tray,#custom-power,#custom-launcher,#niri-window { background-color: ${toRGBA palette.base01 "0.4"}; border-radius: 8px; margin: 0 6px; @@ -168,10 +229,58 @@ in #idle_inhibitor:hover,#backlight:hover,#pulseaudio:hover, #keyboard-state:hover,#network:hover,#cpu:hover,#memory:hover, #temperature:hover,#battery:hover,#power-profiles-daemon:hover, - #clock:hover,#tray:hover,#custom-power:hover,#niri-window:hover { + #clock:hover,#tray:hover,#custom-power:hover,#custom-launcher:hover,#niri-window:hover { background-color: ${toRGBA palette.base02 "0.5"}; } + /* Tooltip styling */ + tooltip { + background-color: ${toRGBA palette.base00 "0.9"}; + border: 1px solid ${toRGBA palette.base07 "0.4"}; + border-radius: 8px; + color: ${toRGBA palette.base05 "0.9"}; + padding: 8px 12px; + font-size: 12px; + } + + tooltip label { + color: ${toRGBA palette.base05 "0.9"}; + } + + /* Calendar tooltip specific stylin/* Tooltip styling */ +tooltip { + background-color: ${toRGBA palette.base00 "0.9"}; + border: 1px solid ${toRGBA palette.base07 "0.4"}; + border-radius: 8px; + color: ${toRGBA palette.base05 "0.9"}; + padding: 8px 12px; + font-size: 12px; +} + +tooltip label { + color: ${toRGBA palette.base05 "0.9"}; +} + +/* Calendar tooltip specific styling */ +#clock tooltip { + font-family: monospace; +} + +/* Network tooltip specific styling */ +#network tooltip { + font-family: monospace; + max-width: 300px; +}g */ + #clock tooltip { + font-family: monospace; + } + + /* Network tooltip specific styling */ + #network tooltip { + font-family: monospace; + max-width: 300px; + } + /* Workspace buttons */ #sway-workspaces button,#niri-workspaces button { padding: 0 6px;