22 lines
524 B
Bash
22 lines
524 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# start emacs server if not is running
|
||
|
systemctl --user status emacs > /dev/null 2>&1 || systemctl --user start emacs > /dev/null 2>&1
|
||
|
|
||
|
# if args is -nw or -t run on terminal
|
||
|
if [ "$1" == "-t" ] || [ "$1" == "-nw" ]; then
|
||
|
emacsclient -t
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
# if no args open new frame
|
||
|
if [ $# -eq 0 ]; then
|
||
|
emacsclient -c -n
|
||
|
emacsclient --eval "(progn (select-frame-set-input-focus (selected-frame)))"
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
emacsclient -e "(frames-on-display-list \"$DISPLAY\")" &>/dev/null
|
||
|
|
||
|
emacsclient -c -n "$*"
|