allowed to run multiple graphical instances.

This commit is contained in:
#root_informatica 2024-04-11 08:22:25 -03:00
parent a8ae36634e
commit 6cf76dbead
1 changed files with 4 additions and 11 deletions

View File

@ -1,15 +1,8 @@
#!/bin/sh
## check if there is an open Emacs window ##
## dependencies: wname, lsw.
## check if it is running inside a terminal and run -t or -c flag. ##
XECMD="emacsclient -c --alternate-editor="""
# 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
[ -t 0 ] && emacsclient -t --alternate-editor="" \
|| emacsclient -c --alternate-editor=""