allowed to run multiple graphical instances.
This commit is contained in:
parent
a8ae36634e
commit
6cf76dbead
15
editor.sh
15
editor.sh
|
@ -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=""
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue