I am running Debian 9.3. I created an .xinitrc file and a symlink, .xsession. File permission was changed to 774.
#!/usr/bin/env bash
#
# This is a sample file for the ~/.xinitrc file.
#
# Set fallback cursor
xsetroot -cursor_name left_ptr
# If Emacs is started in server mode, `emacsclient` is a convenient way to edit
# files in place (used by e.g. `git commit`)
export VISUAL=emacsclient
export EDITOR="$VISUAL"
# Disable access control
xhost +SI:localuser:$USER
## Over-rides
#
xset b off &
#numlockx off # Turn off numlock
# Set keyboard repeat rate
xset r rate 180 40
nm-applet
exec dbus-launch --exit-with-session emacs
My init.el has the following:
(require 'exwm)
(require 'exwm-config)
(setq exwm-workspace-number 4)
(require 'exwm-randr)
(setq exwm-randr-workspace-output-plist '(0 "VGA1"))
(add-hook 'exwm-randr-screen-change-hook
(lambda ()
(start-process-shell-command
"xrandr" nil "xrandr --output VGA1 --left-of LVDS1 --auto")))
(exwm-randr-enable)
[...]
;; Global keybindings can be defined with `exwm-input-global-keys'.
;; Here are a few examples:
(setq exwm-input-global-keys
`(
;; Bind "s-r" to exit char-mode and fullscreen mode.
([?\s-r] . exwm-reset)
;; Bind "s-w" to switch workspace interactively.
([?\s-w] . exwm-workspace-switch)
;; Bind "s-0" to "s-9" to switch to a workspace by its index.
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))
;; Bind "s-&" to launch applications ('M-&' also works if the output
;; buffer does not bother you).
([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; Bind "s-<f2>" to "slock", a simpl0e X display locker.
([s-f2] . (lambda ()
(interactive)
(start-process "" nil "/usr/bin/slock")))))
;; To add a key binding only available in line-mode, simply define it in
;; `exwm-mode-map'. The following example shortens 'C-c q' to 'C-q'.
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
(setq exwm-input-simulation-keys
'(
;; movement
([?\C-b] . [left])
))
;; Do not forget to enable EXWM. It will start by itself when things are
;; ready. You can put it _anywhere_ in your configuration.
(exwm-enable)
When I ran xinit -- vt01 in a virtual console, I received the following error:
(EE) Fatal server error: (EE) Server is already active for display 0 If this server is no longer running, remove /tmp/.X0-lock and start again. [...] XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0" after 7 requests (7 known processed) with 0 events remaining.
I'm not sure how to resolve this, and would appreciate suggestions. Thanks for your time.
EDIT: jue's answer did the trick. I am now encountering a different problem--I've attempted a multi-monitor setup, but do not know how to open emacs in more than one monitor. I cannot seem to bind anything using exwm-input-global-keys with the Super key; funny enough, I am able to setq exwm-input-simulation keys properly. Does anyone know how to have emacs frames open in both monitors in the same workspace?
fvwm2
window manager. :)