From b05509b3a946ce7809b2dc5c635981d50075cf8f Mon Sep 17 00:00:00 2001 From: 0x1d <0x1d@dcentral.systems> Date: Mon, 18 Aug 2025 16:41:55 +0200 Subject: [PATCH] configure waybar --- os/system/desktop/hyprland-config.nix | 202 ++++++++++++++++++-------- 1 file changed, 145 insertions(+), 57 deletions(-) diff --git a/os/system/desktop/hyprland-config.nix b/os/system/desktop/hyprland-config.nix index 707ab47..aef155b 100644 --- a/os/system/desktop/hyprland-config.nix +++ b/os/system/desktop/hyprland-config.nix @@ -195,83 +195,171 @@ # Create Waybar configuration environment.etc."xdg/waybar/config".text = '' { - "layer": "top", - "position": "top", - "height": 30, - "spacing": 4, - "modules-left": ["hyprland/workspaces"], - "modules-center": ["hyprland/window"], - "modules-right": ["battery", "pulseaudio", "network", "cpu", "memory", "clock", "tray"], - "hyprland/workspaces": { - "disable-scroll": true, - "all-outputs": true, - "format": "{name}", + // "layer": "top", // Waybar at top layer + // "position": "bottom", // Waybar position (top|bottom|left|right) + "height": 30, // Waybar height (to be removed for auto height) + // "width": 1280, // Waybar width + "spacing": 4, // Gaps between modules (4px) + // Choose the order of the modules + "modules-left": ["hyprland/workspaces","hyprland/window", "hyprland/mode", "hyprland/scratchpad", "custom/media"], + //"modules-center": ["hyprland/window"], + "modules-right": ["pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "battery", "battery#bat2", "clock", "tray"], + // Modules configuration + // "hyprland/workspaces": { + // "disable-scroll": true, + // "all-outputs": true, + // "warp-on-scroll": false, + // "format": "{icon}", + // //"format": "{name}: {icon}", + // "format-icons": { + // "1": "", + // "2": "", + // "3": "", + // "4": "", + // "5": "", + // "urgent": "", + // "focused": "", + // "default": "" + // } + // }, + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", "format-icons": { - "1": "1", - "2": "2", - "3": "3", - "4": "4", - "5": "5", - "urgent": "urgent" + "locked": "", + "unlocked": "" } }, - "hyprland/window": { - "format": "{}", - "max-length": 50 + + "hyprland/mode": { + "format": "{}" }, - "battery": { - "states": { - "warning": 20, - "critical": 10 + "hyprland/scratchpad": { + "format": "{icon} {count}", + "show-empty": false, + "format-icons": ["", ""], + "tooltip": true, + "tooltip-format": "{app}: {title}" + }, + "mpd": { + "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", + "format-disconnected": "Disconnected ", + "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", + "unknown-tag": "N/A", + "interval": 2, + "consume-icons": { + "on": " " }, - "format": "{icon} {capacity}%", - "format-charging": " {capacity}%", - "format-plugged": " {capacity}%", - "format-alt": "{icon} {time}", - "format-icons": ["", "", "", "", ""], - "on-click": "powerprofilesctl" + "random-icons": { + "off": " ", + "on": " " + }, + "repeat-icons": { + "on": " " + }, + "single-icons": { + "on": "1 " + }, + "state-icons": { + "paused": "", + "playing": "" + }, + "tooltip-format": "MPD (connected)", + "tooltip-format-disconnected": "MPD (disconnected)" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 }, "clock": { - "tooltip-format": "{:%Y %B}\\n{calendar}", - "format": " {:%H:%M}", - "format-alt": " {:%Y-%m-%d %H:%M}" + // "timezone": "America/New_York", + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%Y-%m-%d}" }, "cpu": { - "format": " {usage}%", - "format-icons": ["", "", "", "", ""], + "format": "{usage}% ", "tooltip": false }, "memory": { - "format": " {percentage}%", - "format-icons": ["", "", "", "", ""], - "tooltip": false + "format": "{}% " + }, + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 80, + // "format-critical": "{temperatureC}°C {icon}", + "format": "{temperatureC}°C {icon}", + "format-icons": ["", "", ""] + }, + "backlight": { + // "device": "acpi_video1", + "format": "{percent}% {icon}", + "format-icons": ["", "", "", "", "", "", "", "", ""] + }, + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{time} {icon}", + // "format-good": "", // An empty format will hide the module + // "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + "battery#bat2": { + "bat": "BAT2" }, "network": { - "format-wifi": " {essid}", - "format-ethernet": " {ipaddr}", - "format-disconnected": " Disconnected", - "format-icons": ["", "", "", "", ""], - "tooltip-format": "{ifname} via {gwaddr}", - "max-length": 50 + // "interface": "wlp2*", // (Optional) To force the use of this interface + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ipaddr}/{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" }, "pulseaudio": { - "format": " {volume}%", - "format-bluetooth": " {volume}% ", - "format-bluetooth-muted": " ", - "format-muted": " ", + // "scroll-step": 1, // %, can be a float + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "", "format-icons": { - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["", "", "", ""] + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] }, "on-click": "pavucontrol" }, - "tray": { - "spacing": 10 + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "spotify": "", + "default": "🎜" + }, + "escape": true, + "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder + // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name } } '';