wms/wms_editor.sh
2024-01-21 00:05:04 -03:00

15 lines
373 B
Bash
Executable file

#!/bin/sh
## check if there is an open Emacs window ##
## dependencies: wname, lsw.
. /tmp/wms_var
# search for editor window open.
TARGET=$(for wid in $(lsw -a); do
printf '%s\n' "$wid $(atomx WM_CLASS $wid)"
done | grep $XENAME | cut -d ' ' -f1)
# if editor window is open, focus it; else, start editor.
[ $TARGET ] && wms_mainrole.sh $TARGET \
|| $XECMD