summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-04-06 13:47:53 +0200
committerlassulus <lassulus@lassul.us>2022-04-06 13:47:53 +0200
commitadd7d31c7ebbb6a98f556695f773a98ca4cedad1 (patch)
tree1bc2db314634821ba3e65014d65e155c06736961 /krebs/5pkgs/simple
parentb3833baee96d7bce2c54295110b40c646468a1ff (diff)
parent941476b492f54890a161d7564736b05f083001ed (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r--krebs/5pkgs/simple/pager.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/pager.nix b/krebs/5pkgs/simple/pager.nix
new file mode 100644
index 000000000..ed740490d
--- /dev/null
+++ b/krebs/5pkgs/simple/pager.nix
@@ -0,0 +1,36 @@
+{ 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' \
+ -xrm 'Pager*background: #050505' \
+ -xrm 'Pager*foreground: #d0d7d0' \
+ -e ${pkgs.haskellPackages.pager}/bin/pager "$@"
+''