#!/usr/bin/env bash # a i3-like scratchpad for arbitrary applications. # # this lets a new monitor called "scratchpad" appear in from the top into the # current monitor. There the "scratchpad" will be shown (it will be created if # it doesn't exist yet). If the monitor already exists it is scrolled out of # the screen and removed again. # # Warning: this uses much resources because herbstclient is forked for each # animation step. # # If a tag name is supplied, this is used instead of the scratchpad tag="${1:-scratch}" hc() { herbstclient "$@"; } read -r x y w h </dev/null; then hc substitute M monitors.by-name."$monitor".my_prev_focus \ and + compare monitors.focus.name = "$monitor" \ + focus_monitor M hc remove_monitor "$monitor" else # remember which monitor was focused previously hc chain \ , new_attr string monitors.by-name."$monitor".my_prev_focus \ , substitute M monitors.focus.index \ set_attr monitors.by-name."$monitor".my_prev_focus M hc chain , lock , raise_monitor "$monitor" , focus_monitor "$monitor" \ , unlock , lock_tag "$monitor" fi