commit 7bdaf322cbab6e2652e8cf8be64f44da376518f3 parent 719390f226e5b802c80d73d5779d9f83eb1d5f60 Author: Pablo Cárdenas <pablo.cardenas@imca.edu.pe> Date: Tue, 18 Jun 2024 21:32:01 -0500 wm: fixed scratchpad.sh Diffstat:
| M | .local/bin/scratchpad.sh | | | 23 | ++++++++++++++--------- |
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/.local/bin/scratchpad.sh b/.local/bin/scratchpad.sh @@ -1,16 +1,21 @@ -#!/bin/bash +#!/bin/sh winid=$(xdotool search --class Emacs) visible_winid=$(xdotool search --onlyvisible --class Emacs) -echo $winid -echo $visible_winid -if [ -z "$winid" ]; then + +if [ -z "${winid}" ]; then nohup emacs >/dev/null 2>/dev/null </dev/null & else - if [ -z "$visible_winid" ]; then - echo "$winid" | tac | xargs -I{} xdo show {} - else - echo "$winid" | xargs -I{} xdo hide {} - fi + for id in ${winid}; do + if ! xprop -id "${id}" _NET_WM_OPAQUE_REGION | + grep -q "not found"; then + echo "${id}" + fi + done | + if [ -z "${visible_winid}" ]; then + tac | xargs -I{} xdo show {} + else + xargs -I{} xdo hide {} + fi fi