scratchpad.sh (433B)
1 #!/bin/sh 2 3 winid=$(xdotool search --class Emacs) 4 visible_winid=$(xdotool search --onlyvisible --class Emacs) 5 6 7 if [ -z "${winid}" ]; then 8 nohup emacs >/dev/null 2>/dev/null </dev/null & 9 else 10 for id in ${winid}; do 11 if ! xprop -id "${id}" _NET_WM_OPAQUE_REGION | 12 grep -q "not found"; then 13 echo "${id}" 14 fi 15 done | 16 if [ -z "${visible_winid}" ]; then 17 tac | xargs -I{} xdo show {} 18 else 19 xargs -I{} xdo hide {} 20 fi 21 fi