launch Emacs in daemon mode
authorAmin Bandali <me@aminb.org>
Tue, 9 Jun 2015 03:30:44 +0000 (23:30 -0400)
committerAmin Bandali <me@aminb.org>
Tue, 9 Jun 2015 03:30:44 +0000 (23:30 -0400)
sxhkd/.config/sxhkd/sxhkdrc
sxhkd/.local/bin/em [new file with mode: 0755]
x/.xprofile

index 013eea9..0b98505 100644 (file)
@@ -90,7 +90,7 @@ super + x
     slimlock
 
 super + e
     slimlock
 
 super + e
-    emacs
+    em
 
 super + r
     firefox
 
 super + r
     firefox
diff --git a/sxhkd/.local/bin/em b/sxhkd/.local/bin/em
new file mode 100755 (executable)
index 0000000..6d087f3
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ -z "$DISPLAY" ]; then
+    IS_GRAPHICAL=true
+else
+    IS_GRAPHICAL=$(emacs --batch -Q --eval='(if (fboundp '"'"'tool-bar-mode) (message "true") (message "false"))' 2>&1)
+fi
+
+if $IS_GRAPHICAL; then
+    emacsclient -a "" -nc "$@"
+else
+    emacsclient -a "" -t "$@"
+fi
index c91f71a..cbaeed0 100755 (executable)
@@ -72,6 +72,7 @@ xfdesktop --disable-wm-check &
 xfce4-panel --disable-wm-check &
 bspwm &
 sxhkd &
 xfce4-panel --disable-wm-check &
 bspwm &
 sxhkd &
+emacs --daemon &
 sleep 2 && pnmixer &
 # panel &
 
 sleep 2 && pnmixer &
 # panel &
 
@@ -81,4 +82,3 @@ sleep 2 && pnmixer &
 #      bspwm) exec bspwm;;
 #      *) exec $DEFAULTSESSION ;;
 # esac
 #      bspwm) exec bspwm;;
 #      *) exec $DEFAULTSESSION ;;
 # esac
-