]> git.sur5r.net Git - i3/i3/blobdiff - i3-sensible-pager
Introduce the i3-sensible-{pager,editor,terminal} scripts
[i3/i3] / i3-sensible-pager
diff --git a/i3-sensible-pager b/i3-sensible-pager
new file mode 100755 (executable)
index 0000000..5af8d6b
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+# This script tries to exec a pager by trying some known pagers if $PAGER is
+# not set.
+#
+# Distributions/packagers can enhance this script with a
+# distribution-specific mechanism to find the preferred pager.
+which $PAGER >/dev/null && exec $PAGER "$@"
+
+# Hopefully one of these is installed:
+which most >/dev/null && exec most "$@"
+which less >/dev/null && exec less "$@"
+# we don't use 'more' because it will exit if the file is 'too short'
+
+# If no pager is installed, try an editor
+exec i3-sensible-editor "$@"