From 9e045cf0967410b16071a5aa9814d890585f98d6 Mon Sep 17 00:00:00 2001 From: Timo Date: Fri, 4 Sep 2026 16:52:15 +0200 Subject: [PATCH] waybar: show the bar on this machine's primary output The deployed config pinned "output": "eDP-1", the laptop's internal display. On the PC waybar started fine but never mapped a layer surface, so there was no bar and SIGUSR1 had nothing to toggle. Listed both profiles' primaries instead -- waybar skips names that are not connected, so the one file works on the laptop and the PC. Two bugs in the same config that this uncovered: - bars/main.jsonc included modules/temperature.cpu.jsonc, but the file is temperature-cpu.jsonc, so the temperature#cpu module the bar referenced was silently absent. - get_wg_status.sh ran `sudo wg show` with no tty, logging "a terminal is required to read the password" on every poll. Now `sudo -n`, which fails instantly and falls into the existing "disconnected" branch, and starts working as-is if a NOPASSWD rule is ever added. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01StGBghPW9Dm7z7uj2VNWHr --- waybar/bars/main.jsonc | 2 +- waybar/config.jsonc | 5 ++++- waybar/scripts/get_wg_status.sh | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/waybar/bars/main.jsonc b/waybar/bars/main.jsonc index e608a1a..bd36332 100644 --- a/waybar/bars/main.jsonc +++ b/waybar/bars/main.jsonc @@ -7,7 +7,7 @@ "~/.config/waybar/modules/pulseaudio.jsonc", "~/.config/waybar/modules/cpu.jsonc", "~/.config/waybar/modules/memory.jsonc", - "~/.config/waybar/modules/temperature.cpu.jsonc", + "~/.config/waybar/modules/temperature-cpu.jsonc", "~/.config/waybar/modules/battery.jsonc", "~/.config/waybar/modules/network.jsonc", "~/.config/waybar/modules/wireguard.jsonc", diff --git a/waybar/config.jsonc b/waybar/config.jsonc index eb8cd64..d59df89 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -3,7 +3,10 @@ "include": "~/.config/waybar/bars/main.jsonc", "height": 50, "layer": "top", - "output": "eDP-1", + // Primary output of each machine profile (see hypr/configs/profiles): + // eDP-1 on the laptop, DP-1 on the PC. Waybar skips names that are + // not connected, so one list works on both. + "output": ["eDP-1", "DP-1"], "mode": "dock", "exclusive": true, "passtrough": false, diff --git a/waybar/scripts/get_wg_status.sh b/waybar/scripts/get_wg_status.sh index 5de62f7..1ab264b 100755 --- a/waybar/scripts/get_wg_status.sh +++ b/waybar/scripts/get_wg_status.sh @@ -44,7 +44,9 @@ function format { } # Read wg show output and format -wg_show_output=$(sudo wg show) +# -n so a missing NOPASSWD sudoers rule fails instantly instead of blocking +# the module on a password prompt it has no terminal to ask on. +wg_show_output=$(sudo -n wg show 2>/dev/null) if [[ -z $wg_show_output ]]; then echo "{ \"text\": \"---\", \"tooltip\": \"disconnected\", \"class\": \"\", \"percentage\": 0 }"