aboutsummaryrefslogtreecommitdiffstats
path: root/dmenu/man
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-06-26 14:59:09 +0200
committerMattias Andrée <maandree@kth.se>2021-06-26 14:59:09 +0200
commitf62eca657a79ef81089f3c34cdf837d7463581db (patch)
treeb8bdf542c8bee229c51e9cdcaf150d68f6d2e365 /dmenu/man
parentAdd setkeys and setres (diff)
downloaddotfiles-f62eca657a79ef81089f3c34cdf837d7463581db.tar.gz
dotfiles-f62eca657a79ef81089f3c34cdf837d7463581db.tar.bz2
dotfiles-f62eca657a79ef81089f3c34cdf837d7463581db.tar.xz
Add ipa, man, and unicode scripts
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'dmenu/man')
-rwxr-xr-xdmenu/man39
1 files changed, 39 insertions, 0 deletions
diff --git a/dmenu/man b/dmenu/man
new file mode 100755
index 0000000..1b29656
--- /dev/null
+++ b/dmenu/man
@@ -0,0 +1,39 @@
+#!/bin/dash
+
+# Browse with dmenu if no page has been specified
+if test $# = 0; then
+ manpage="$(/usr/bin/man -k '' | dmenu -l 40 | sed 's/^\([^ ]*\) (\([^)]*\)).*$/\2 \1/')"
+ if test -z "$manpage"; then
+ exit 1
+ fi
+ set $manpage
+fi
+
+
+# Bold
+export LESS_TERMCAP_md="$(printf '\033[01;34m')"
+export LESS_TERMCAP_me="$(printf '\033[0m')"
+
+# Italic
+export LESS_TERMCAP_us="$(printf '\033[01;04;32m')"
+export LESS_TERMCAP_ue="$(printf '\033[0m')"
+
+# Reverse video
+if test "$TERM" = linux; then
+ export LESS_TERMCAP_so="$(printf '\033[07m')"
+else
+ export LESS_TERMCAP_so="$(printf '\033[07;01m')"
+fi
+export LESS_TERMCAP_se="$(printf '\033[0m')"
+
+
+# Display, open new terminal if in the background
+if isfg; then
+ exec /usr/bin/man "$@"
+elif test -x /usr/bin/terminator; then
+ exec terminator -e "/usr/bin/man $*"
+elif test -x /usr/bin/st; then
+ exec st -e /usr/bin/man "$@"
+else
+ exec xterm -e /usr/bin/man "$@"
+fi