diff options
author | tv <tv@krebsco.de> | 2022-04-05 22:16:29 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2022-04-05 22:29:55 +0200 |
commit | 1407ad3502a7dd46d6e432b7ccc013bc80341bb1 (patch) | |
tree | 612042b7178ce8bf16990c375205a627082cfce6 /krebs/5pkgs/simple | |
parent | 8d3688ecfd4a0f1a8908a0cb471e7b7792d9b54b (diff) |
pager: init at 1.0.0
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r-- | krebs/5pkgs/simple/pager.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/pager.nix b/krebs/5pkgs/simple/pager.nix new file mode 100644 index 000000000..f156f7414 --- /dev/null +++ b/krebs/5pkgs/simple/pager.nix @@ -0,0 +1,34 @@ +{ pkgs }: + +pkgs.writeDashBin "pager" '' + # usage: pager {view,shift,shiftview} + # + # Environment variables + # + # PAGER_NAME (default: Pager) + # The environment variables specifies the application name under which + # resources are to be obtained. PAGER_NAME should not contain “.” or “*” + # characters. + # + set -efu + + pidfile=$XDG_RUNTIME_DIR/pager.lock + name=''${PAGER_NAME-Pager} + + if test -e "$pidfile" && + ${pkgs.procps}/bin/pgrep --pidfile="$pidfile" >/dev/null + then + ${pkgs.procps}/bin/pkill --pidfile="$pidfile" + ${pkgs.coreutils}/bin/rm "$pidfile" + exit + fi + + echo $$ > "$pidfile" + + exec ${pkgs.xterm}/bin/xterm \ + -name "$name" \ + -ti vt340 \ + -xrm 'Pager*geometry: 32x10' \ + -xrm 'Pager*internalBorder: 2' \ + -e ${pkgs.haskellPackages.pager}/bin/pager "$@" +'' |