summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThorsten Wißmann <edu@thorsten-wissmann.de>2012-09-14 17:26:11 +0200
committerThorsten Wißmann <edu@thorsten-wissmann.de>2012-09-14 17:26:11 +0200
commit97702235d28fec5138f01e068b02c4cd87b67cbc (patch)
treed13f3f0c40685ddab91e83293a15a15c45c4b142 /scripts
parent0415f55170f29276d01eadbce6ec38ac490d523c (diff)
Add scripts/lasttag.sh
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/lasttag.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/lasttag.sh b/scripts/lasttag.sh
new file mode 100755
index 00000000..98c68792
--- /dev/null
+++ b/scripts/lasttag.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# usage: start this script in anywhere your autostart (but *after* the
+# emit_hook reload line)
+
+# to switch to the last tag, call: herbstclient emit_hook goto_last_tag
+# or bind it: herbstclient keybind Mod1-Escape emit_hook goto_last_tag
+
+herbstclient --idle '(tag_changed|goto_last_tag|reload)' \
+ | while read line ; do
+ ARGS=( $line )
+ case ${ARGS[0]} in
+ tag_changed)
+ LASTTAG="$TAG"
+ TAG=${ARGS[1]}
+ ;;
+ goto_last_tag)
+ ! [ -z "$LASTTAG" ] && herbstclient use "$LASTTAG"
+ ;;
+ reload)
+ exit
+ ;;
+ esac
+ done
+
+
+