diff options
Diffstat (limited to 'herbstluftwm/scripts')
| -rwxr-xr-x | herbstluftwm/scripts/hide.sh | 18 | ||||
| -rwxr-xr-x | herbstluftwm/scripts/lasttag.sh | 25 |
2 files changed, 43 insertions, 0 deletions
diff --git a/herbstluftwm/scripts/hide.sh b/herbstluftwm/scripts/hide.sh new file mode 100755 index 0000000..8450f17 --- /dev/null +++ b/herbstluftwm/scripts/hide.sh @@ -0,0 +1,18 @@ +#!/bin/sh +function tag() { + herbstclient list_monitors | grep ‘[FOCUS]’ | cut -d’”’ -f2 +} + +tag=$(tag) +case "$@" in + +1) herbstclient dump “‘$tag” || herbstclient add “‘$tag” + herbstclient move “‘$tag” + ;; + -1) if herbstclient dump “‘$tag”; then + herbstclient chain . lock . use “‘$tag” + winid=$(herbstclient attr clients.focus.winid) + herbstclient chain . use $tag . bring $winid . unlock + fi + ;; + 0|*) herbstclient dump “‘$tag” && herbstclient merge_tag “‘$tag” ;; +esac diff --git a/herbstluftwm/scripts/lasttag.sh b/herbstluftwm/scripts/lasttag.sh new file mode 100755 index 0000000..dd89314 --- /dev/null +++ b/herbstluftwm/scripts/lasttag.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env 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 + +hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;} +hc --idle '(tag_changed|goto_last_tag|reload)' \ + | while read line ; do + IFS=$'\t' read -ra args <<< "$line" + case ${args[0]} in + tag_changed) + lasttag="$tag" + tag=${args[1]} + ;; + goto_last_tag) + [ "$lasttag" ] && hc use "$lasttag" + ;; + reload) + exit + ;; + esac + done |
