#!/bin/sh # tmux prefix+L (switch-client -l): back to the previously focused workspace -- # herdr's workspace is tmux's session. `last window` is tmux's prefix+l # (last-window): this machine's tmux.conf took l for select-pane -R, so it has # no key there and none here, but the : prompt has it. Going back focuses the # old one, which track-focus records, so repeating toggles -- as in tmux. . "$(dirname "$0")/../lib.sh" dir="$(state_dir)" case "${1:-}" in window) ws="$(pane_info "$(active_pane)" workspace_id)" t="$(cat "$dir/tab.$(key_of "$ws").previous" 2>/dev/null || true)" [ -n "$t" ] && "$H" tab get "$t" >/dev/null 2>&1 || fail "no last window" "$H" tab focus "$t" >/dev/null ;; session) w="$(cat "$dir/workspace.previous" 2>/dev/null || true)" [ -n "$w" ] && "$H" workspace get "$w" >/dev/null 2>&1 || fail "can't find last session" "$H" workspace focus "$w" >/dev/null ;; *) fail "usage: last window|session" ;; esac