summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-12-09 21:53:09 +0100
committertv <tv@krebsco.de>2022-12-09 21:54:29 +0100
commitfe01fe6bf411623582f8f21d5b8adb0e4729a7c1 (patch)
tree2fb4b3681112eadc29bfb00d6c08bd7059a3f949 /tv
parent9051f57095d4edfd22a68aa2798e38a44a2c94cb (diff)
tv pinentry-urxvt: kill only screenshot displayers
Diffstat (limited to 'tv')
-rw-r--r--tv/5pkgs/simple/pinentry-urxvt/default.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/tv/5pkgs/simple/pinentry-urxvt/default.nix b/tv/5pkgs/simple/pinentry-urxvt/default.nix
index c768a9f5b..ad8039ff2 100644
--- a/tv/5pkgs/simple/pinentry-urxvt/default.nix
+++ b/tv/5pkgs/simple/pinentry-urxvt/default.nix
@@ -52,25 +52,26 @@ in
trap cleanup EXIT
cleanup() {
+ ${pkgs.utillinux}/bin/kill -- $(${pkgs.coreutils}/bin/cat "$displayers")
+ rm "$displayers"
rm "$screenshot"
- # Kill process group in order to kill screenshot windows.
- ${pkgs.utillinux}/bin/kill 0
}
- screenshot=$(${pkgs.coreutils}/bin/mktemp -t pinentry-urxvt.screenshot.XXXXXXXX)
+ displayers=$(${pkgs.coreutils}/bin/mktemp -t pinentry-urxvt.$$.displayers.XXXXXXXX)
+ screenshot=$(${pkgs.coreutils}/bin/mktemp -t pinentry-urxvt.$$.screenshot.XXXXXXXX)
${pkgs.xorg.xwd}/bin/xwd -root |
${pkgs.imagemagick}/bin/convert xwd:- -fill \#424242 -colorize 80% xwd:"$screenshot"
- show_screenshot() {
- ${pkgs.exec "pinentry-urxvt.show_screenshot" {
+ display_screenshot() {
+ ${pkgs.exec "pinentry-urxvt.display_screenshot" {
filename = "${pkgs.xorg.xwud}/bin/xwud";
argv = [
cfg.xwud.className
"-noclick"
];
}} < "$screenshot" &
- wait_for_screenshot $!
+ wait_for_screenshot $! && echo $! >>"$displayers"
}
# Wait for the xwud window by trying to intercept the call to munmap().
@@ -92,12 +93,12 @@ in
fi
}
- show_screenshot
+ display_screenshot
${lib.optionalString (cfg.display != null) /* sh */ ''
if test "$DISPLAY" != ${lib.shell.escape cfg.display}; then
export DISPLAY=${lib.shell.escape cfg.display}
- show_screenshot
+ display_screenshot
fi
''}