From: Volker Schlecht Subject: Re: wayland/waybar: default config To: Landry Breuil , ports , Lydia Sobot Date: Sun, 29 Mar 2026 11:44:55 +0200 On 3/29/26 9:00 AM, Landry Breuil wrote: > Le Sun, Mar 29, 2026 at 12:30:20AM +0100, Volker Schlecht a écrit : >> Our current default config has a typo in the sndio module, and provides >> example configurations that afaict don't have a change of working on OpenBSD >> or require additional scripts to work. > > i havent tested at all, but i see no reason to disable upower, if > installed it should just work to report the battery levels (unless > theres' some plumbing to call the apm lowlevel interface instead ?) > > i think we should completely remove lines for the ones we know will > never work (eg the things relying on linux things), and leave commented > out lines for the ones that require extra rundeps like pulseaudio, mpd & > upower ? Thanks, Lydia and Landry, for the feedback. Here's my next attempt: * Add modules for niri as alternative to the sway modules That should work for both niri and sway-compatible compositors * Comment mpd, upower as per Landry's suggestion * Remove "keyboard-state" section because [warning] module keyboard-state: Unknown module: keyboard-state * Remove "network" because [warning] module network: Unknown module: network * Remove power-profiles-daemon, battery because they are not being built * Remove "custom/media" since it depends on a missing script * Still remove module pulseaudio, because it's not getting built (-Dpulseaudio=disabled) * Fixes Clock "argument not found error" (calendar popup doesn't work on OpenBSD) * Fix sndio example configuration * Replace temperature by "custom/temperature" that uses sysctl instead of /sys/ (I don't have an AMD CPU around to test - will probably need tweaking there) * Replace battery by "custom/battery" that uses apm to show battery percentage * Change to a simpler custom/power that doesn't depend on an otherwise missing menu configuration * Not tested: backlight, tray While not full-featured, I think that's a sensible configuration that provides a useful starting point for customizations, isn't too opinionated, and doesn't invite attempts to configure missing modules. Index: patches/patch-resources_config_jsonc =================================================================== RCS file: /cvs/ports/wayland/waybar/patches/patch-resources_config_jsonc,v retrieving revision 1.2 diff -u -p -r1.2 patch-resources_config_jsonc --- patches/patch-resources_config_jsonc 3 Mar 2026 19:18:12 -0000 1.2 +++ patches/patch-resources_config_jsonc 29 Mar 2026 09:42:52 -0000 @@ -1,61 +1,184 @@ -Tweak configuration for OpenBSD +Tweak configuration for OpenBSD Index: resources/config.jsonc --- resources/config.jsonc.orig +++ resources/config.jsonc -@@ -17,21 +17,23 @@ +@@ -7,30 +7,28 @@ + "spacing": 4, // Gaps between modules (4px) + // Choose the order of the modules + "modules-left": [ ++ "niri/workspaces", + "sway/workspaces", + "sway/mode", + "sway/scratchpad", +- "custom/media" + ], + "modules-center": [ ++ "niri/window", + "sway/window" ], "modules-right": [ - "mpd", +- "mpd", - "idle_inhibitor", - "pulseaudio", - "network", - "power-profiles-daemon", -+ // "idle_inhibitor", -+ // "pulseaudio", -+ "sndio", -+ // "network", -+ // "power-profiles-daemon", ++ //"mpd", ++ "sndio", "cpu", "memory", - "temperature", -- "backlight", ++ "custom/battery", ++ "custom/temperature", + "backlight", - "keyboard-state", -+ // "temperature", -+ // "backlight", -+ // "keyboard-state", "sway/language", - "battery", - "battery#bat2", -+ "upower", -+ // "battery", -+ // "battery#bat2", "clock", -- "tray", -- "custom/power" -+ "tray" -+ // "custom/power" + "tray", ++ //upower, ++ "idle_inhibitor", + "custom/power" ], // Modules configuration - // "sway/workspaces": { -@@ -69,6 +71,12 @@ - "tooltip": true, - "tooltip-format": "{app}: {title}" +@@ -50,15 +48,6 @@ + // "default": "" + // } + // }, +- "keyboard-state": { +- "numlock": true, +- "capslock": true, +- "format": "{name} {icon}", +- "format-icons": { +- "locked": "", +- "unlocked": "" +- } +- }, + "sway/mode": { + "format": "{}" }, -+ "sndio": { -+ "sroll-step": "10", -+ "format": "  {volume}% ", -+ // "on-scroll-down": "sndioctl output.level=-0.1", -+ // "on-scroll-up": "sndioctl output.level=+0.1" -+ }, - "mpd": { - "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", - "format-disconnected": "Disconnected ", -@@ -112,7 +120,6 @@ +@@ -112,7 +101,7 @@ }, "clock": { // "timezone": "America/New_York", - "tooltip-format": "{:%Y %B}\n{calendar}", ++ "format": "{:%H:%M}  ", "format-alt": "{:%Y-%m-%d}" }, "cpu": { +@@ -122,98 +111,30 @@ + "memory": { + "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-full": "{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": ["", "", "", "", ""] ++ "sndio": { ++ "scroll-step": "1", ++ "format": "  {volume}% ", ++ "on-scroll-down": "sndioctl output.level=-0.01", ++ "on-scroll-up": "sndioctl output.level=+0.01" + }, +- "battery#bat2": { +- "bat": "BAT2" ++ "custom/battery": { ++ "format": "{}% 🔋", ++ "interval": 5, ++ "exec": "apm -l" + }, +- "power-profiles-daemon": { +- "format": "{icon}", +- "tooltip-format": "Power profile: {profile}\nDriver: {driver}", +- "tooltip": true, +- "format-icons": { +- "default": "", +- "performance": "", +- "balanced": "", +- "power-saver": "" +- } ++ "custom/temperature": { ++ "format": "{} °C", ++ "interval": 5, ++ "exec": "sysctl hw.sensors.cpu0.temp0 | cut -d \"=\" -f 2 | cut -d \".\" -f 1" + }, +- "network": { +- // "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": { +- // "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": ["", "", ""] +- }, +- "on-click": "pavucontrol" +- }, +- "custom/media": { +- "format": "{icon} {text}", +- "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 +- }, + "custom/power": { +- "format" : "⏻ ", +- "tooltip": false, +- "menu": "on-click", +- "menu-file": "$HOME/.config/waybar/power_menu.xml", // Menu file in resources folder +- "menu-actions": { +- "shutdown": "shutdown", +- "reboot": "reboot", +- "suspend": "systemctl suspend", +- "hibernate": "systemctl hibernate" +- } ++ "format" : "⏻", ++ "tooltip": "Sleep", ++ "on-click": "zzz" + } + } Index: patches/patch-resources_style_css =================================================================== RCS file: /cvs/ports/wayland/waybar/patches/patch-resources_style_css,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-resources_style_css --- patches/patch-resources_style_css 4 Jan 2026 18:15:27 -0000 1.1.1.1 +++ patches/patch-resources_style_css 29 Mar 2026 09:42:52 -0000 @@ -3,7 +3,31 @@ Add styles for upower and sndio. Index: resources/style.css --- resources/style.css.orig +++ resources/style.css -@@ -164,6 +164,21 @@ button:hover { +@@ -93,7 +93,10 @@ button:hover { + #idle_inhibitor, + #scratchpad, + #power-profiles-daemon, +-#mpd { ++#mpd, ++#custom-power, ++#custom-battery, ++#custom-temperature { + padding: 0 10px; + color: #ffffff; + } +@@ -122,6 +125,11 @@ button:hover { + color: #000000; + } + ++#custom-battery { ++ background-color: #ffffff; ++ color: #000000; ++} ++ + #battery.charging, #battery.plugged { + color: #ffffff; + background-color: #26A65B; +@@ -164,6 +172,21 @@ button:hover { color: #000000; } @@ -25,20 +49,31 @@ Index: resources/style.css label:focus { background-color: #000000; } -@@ -199,6 +214,16 @@ label:focus { +@@ -203,6 +226,16 @@ label:focus { + color: #2a5c45; } - #pulseaudio.muted { -+ background-color: #90b1b1; -+ color: #2a5c45; -+} -+ +#sndio { + background-color: #f1c40f; + color: #000; +} + +#sndio.muted { - background-color: #90b1b1; - color: #2a5c45; ++ background-color: #90b1b1; ++ color: #2a5c45; ++} ++ + #wireplumber { + background-color: #fff0f5; + color: #000000; +@@ -227,6 +260,10 @@ label:focus { } + + #temperature { ++ background-color: #f0932b; ++} ++ ++#custom-temperature { + background-color: #f0932b; + } +