From The Compiler, 6 Years ago, written in Bash.
Embed
  1. herbstclient --idle '(focus_changed|focus_last)' | while read hook id x; do
  2.     case "$hook" in
  3.         focus_changed)
  4.             [[ "$focused" ]] && lastfocused="$focused"
  5.             focused="$id"
  6.         ;;
  7.         focus_last)
  8.             [[ "$lastfocused" ]] && herbstclient jumpto "$lastfocused"
  9.         ;;
  10.     esac
  11. done