0

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?

  • You should put your edit in a new question otherwise no one will read it. I can't help you there, because I'm using the fantastic and unbeatable fvwm2 window manager. :) – jue Mar 5 '18 at 19:14
0

I d not know your system setup or system knowledge, but this error message means on your system is an X-server running already and X11 cannot use that display (number 0) again.
So either you stop that X-server before launching xinit. Or you use another display for this new server.
If you just booted you Linux box with that .xinitrc file, then chances are good, your exwm is already running.

You could try following command: xinit xterm -- :1 vt08 to start a new X-server with just an xterm on another display (number 1).
If that works, quit this new x-server and try:
xinit emacs -- :1 vt08 or xinit -- :1 vt08.

  • I'm now encountering two unrelated problems, which I amended the OP to describe. I don't know how to open more than one emacs frame in a given workspace (ideally i would have one in each monitor), and I'm having trouble binding exwm-input-global-keys. Would you happen to have any suggestions? – Brian Leung Mar 5 '18 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.