33 lines
693 B
Bash
Executable file
33 lines
693 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# Check to see if an emacsclient is running
|
|
if [ $(pgrep -c emacsclient) -gt 0 ]; then
|
|
|
|
if [ $XDG_SESSION_TYPE = "x11" ]; then
|
|
#X11
|
|
emacsrg=$(wmctrl -lx | rg emacs | rg -v org-agenda | awk '{print $1}')
|
|
echo $emacsrg
|
|
|
|
if [ -z $emacsrg ]; then
|
|
emacsclient -c
|
|
exit
|
|
else
|
|
wmctrl -ia $emacsrg
|
|
exit
|
|
fi
|
|
|
|
else
|
|
# WAYLAND
|
|
emacsrg=$(wlrctl window list | rg -v 'emacs:\sorg-agenda' | rg 'emacs:')
|
|
|
|
emacswin=$(echo $emacsrg | sed 's/.*\: //')
|
|
echo $emacswin
|
|
|
|
wlrctl toplevel focus title:"$emacswin"
|
|
exit
|
|
fi
|
|
|
|
else
|
|
emacsclient -c
|
|
fi
|