aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:36 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:36 +0100
commit1238e4dfc33bc4347564350bbfadac50aa8da0cd (patch)
tree3898cd089a601e30db6311da45006fc68b953f12
parentf685f20f7a41e6b5c4d56e46a9c8fba7c3287a68 (diff)
downloaddotfiles-1238e4dfc33bc4347564350bbfadac50aa8da0cd.tar.gz
dotfiles-1238e4dfc33bc4347564350bbfadac50aa8da0cd.tar.bz2
dotfiles-1238e4dfc33bc4347564350bbfadac50aa8da0cd.zip
fix(waybar): pacdiff click — set DIFFPROG inside the root shell
sudo-rs scrubs the env by default, so neither `DIFFPROG=… sudo pacdiff` nor `sudo DIFFPROG=… pacdiff` reaches pacdiff with the variable set. Sidestep the env-policy question entirely by running sudo sh -c 'DIFFPROG="nvim -d" pacdiff' so the assignment happens inside the privileged shell, after the env-scrubbing boundary. No sudoers-rs change required, and the same form works identically under stock sudo if the user ever switches back.
-rw-r--r--dot_config/waybar/config.jsonc2
-rwxr-xr-xdot_config/waybar/executable_pacdiff-status.sh6
2 files changed, 5 insertions, 3 deletions
diff --git a/dot_config/waybar/config.jsonc b/dot_config/waybar/config.jsonc
index 12d1255..a68278f 100644
--- a/dot_config/waybar/config.jsonc
+++ b/dot_config/waybar/config.jsonc
@@ -227,7 +227,7 @@
"exec": "~/.config/waybar/pacdiff-status.sh",
"return-type": "json",
"interval": 300,
- "on-click": "ghostty --class=floating -e sh -c 'sudo DIFFPROG=\"nvim -d\" pacdiff; printf \"\\n[done — press enter] \"; read _'",
+ "on-click": "ghostty --class=floating -e sh -c 'sudo sh -c \"DIFFPROG=\\\"nvim -d\\\" pacdiff\"; printf \"\\n[done — press enter] \"; read _'",
"tooltip": true,
},
diff --git a/dot_config/waybar/executable_pacdiff-status.sh b/dot_config/waybar/executable_pacdiff-status.sh
index dad3166..e1a2291 100755
--- a/dot_config/waybar/executable_pacdiff-status.sh
+++ b/dot_config/waybar/executable_pacdiff-status.sh
@@ -5,8 +5,10 @@
# from "no problems" to "non-zero" (i.e. on the post-`pacman -Syu`
# settle), so you're nudged exactly once per upgrade wave.
#
-# Click handler runs `sudo DIFFPROG='nvim -d' pacdiff` in a floating
-# ghostty.
+# Click handler hands off to a root shell that sets DIFFPROG before
+# invoking pacdiff (sudo-rs scrubs the env by default, so passing
+# `DIFFPROG=… sudo pacdiff` or `sudo DIFFPROG=… pacdiff` doesn't
+# survive — but `sudo sh -c 'DIFFPROG=… pacdiff'` does).
set -eu