ch11ng / exwm

Emacs X Window Manager
2.85k stars 135 forks source link

EXWM doesn't fill the screen when I rotate it #533

Closed ieure closed 4 years ago

ieure commented 5 years ago

If I rotate my display with:

xrandr --output eDP1 --rotate lef

EXWM maintains the old dimensions and I can't resize it to take up the full screen. Toggling the frame's full-screen bit does nothing. Evaluating (exwm-randr-refresh) produces the following error:

Debugger entered--Lisp error: (wrong-type-argument (or eieio-object class) nil obj)
  signal(wrong-type-argument ((or eieio-object class) nil obj))
  slot-value(nil timestamp)
  exwm-randr--get-monitors()
  exwm-randr-refresh()
  funcall-interactively(exwm-randr-refresh)
  call-interactively(exwm-randr-refresh record nil)
  command-execute(exwm-randr-refresh record)
  execute-extended-command(nil "exwm-randr-refresh" nil)
  funcall-interactively(execute-extended-command nil "exwm-randr-refresh" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

This is 0.21, running on Debian Stretch.

ch11ng commented 5 years ago

I believe the command should be xrandr --output eDP1 --rotate left (you misspelled the 'left'). After rotation the width & height of screen would be automatically swapped so there's really nothing to do on WM's side.

ieure commented 5 years ago

I believe the command should be xrandr --output eDP1 --rotate left (you misspelled the 'left'). After rotation the width & height of screen would be automatically swapped so there's really nothing to do on WM's side.

I just missed the last character when I copied the command.

When I tried before, I had let EXWM come up, added the xrandr stuff to my EXWM config, and eval'd it by hand. This time, it was already there. Does (exwm-randr-enable) require being evaluated at a particular time in order to work? If so, is there a way to make it more obvious if it's enabled at the wrong time?

ch11ng commented 5 years ago

exwm-randr-enable simply registers some hooks, and should be called before exwm-init which is called when Emacs has just finished starting. In short, call exwm-randr-enable as early as possible.

ieure commented 4 years ago

I'm still struggling to get this to work and would appreciate any feeback or pointers you may have. Ideally, I'd like my laptop's display in normal orientation, and an external display rotated to portrait. However, even taking the second monitor out of the mix and trying to rotate my built-in panel, I can't get it to work.

I'm rotating with:

xrandr --output eDP-1 --rotate right

Which I run inside a shell inside Emacs.

It seems like Emacs is getting resized correctly when I rotate the output -- both (frame-geometry) and xwininfo report that the X/Y dimensions have traded places. Both xwininfo and (frame-geometry) also report that Emacs' position is 0, 0. Despite this, Emacs' position appears to extend off the top of the display, and not to fill the bottom.

After rotating the display, this is what I see. This was captured with xwd -out whole-screen.xwd -root and converted to PNG.

whole-screen

But, if I capture the Emacs window only (with xwd -out emacs.xwd -id 0x1000027 -- the ID coming from xwininfo), you can see that it has the right size and looks fine:

emacs

So it seems to be a positioning issue, rather than a resizing one.

My EXWM configuration ```emacs-lisp ;;; ime-exwm.el --- EXWM Configuration -*- lexical-binding: t; -*- (defun ime-exwm--disable-cruft () (setq-local line-number-mode nil) (setq-local column-number-mode nil) (setq-local size-indication-mode nil)) (defun ime-exwm-retitle (new-title) (require 's) (let* ((base-name (concat "*" new-title "*"))) (unless (s-contains? (concat "*" new-title) (buffer-name)) (rename-buffer (generate-new-buffer-name base-name))))) (defun ime-exwm--nextcloud-setup () "Configure Nextcloud for EXWM." (when (and (string= exwm-title "Nextcloud") exwm--floating-frame) (exwm-floating-toggle-floating))) (defun ime-exwm--nautilus-popup-setup () "Configure Nautilus popups for EXWM." (when (and (string= exwm-class-name "Sushi-start") exwm--floating-frame) (exwm-floating-toggle-floating))) (defun ime-exwm--generic-setup () "Default EXWM window setup. This changes the EXWM buffer for the window." (unless (eq (elt (buffer-name) 0) ?*) ; Unless it starts with * already (ime-exwm-retitle (downcase exwm-class-name)))) (use-package exwm :if (and (string= "1" (getenv "EXWM_HOST")) (eq 'x window-system)) :straight (exwm :host github :repo "ch11ng/exwm" :tag "0.23") :config (require 'exwm-config) (require 'exwm-randr) (exwm-randr-enable) (add-hook 'exwm-update-class-hook (lambda () (exwm-workspace-rename-buffer exwm-class-name))) (exwm-enable) (exwm-config-misc) (add-to-list 'exwm-manage-finish-hook #'ime-exwm--disable-cruft) (add-to-list 'exwm-manage-finish-hook #'ime-exwm--nextcloud-setup) (add-to-list 'exwm-manage-finish-hook #'ime-exwm--nautilus-popup-setup) (add-to-list 'exwm-manage-finish-hook #'ime-exwm--generic-setup)) (use-package exwm-edit :if (and (string= "1" (getenv "EXWM_HOST")) (eq 'x window-system)) :after exwm :diminish "" :straight (exwm-edit) :config (exwm-edit-mode 1)) (use-package exwm-firefox :demand t :straight (exwm-firefox :host github :repo "ieure/exwm-firefox") :config (exwm-firefox-mode)) (provide 'ime-exwm) ;;; ime-exwm.el ends here ```
ch11ng commented 4 years ago

xrandr --output eDP-1 --rotate right

I just tried this and didn't notice the problem. From what you reported it's probably due to misplaced workspace container. Please check the value of exwm-workspace--workareas (list of [X Y WIDTH HEIGHT]) and exwm-workspace--struts.

ieure commented 4 years ago

Okay, I messed with this a bit more, and it's not an EXWM bug. The issue is that I'm running Compton to fix screen tearing with the Intel modesetting driver, and it fails to notice that the screen geometry has changed. Restarting it after the screen's rotated fixes the issue (or nor using it at all).

Is there a recommended external compositor for EXWM?

nawetimebomb commented 4 years ago

@ieure I use picom (as Compton hasn't been updated for years now). It's a Compton fork and it works great for me. I run XFCE with EXWM as my Window Manager but I disabled all things related to XFWM (XFCE's official WM), so picom is my only Composite manager. Hope it works for you too.

tamsky commented 3 years ago

In case it wasn't clear from the docs (it wasn't for me) -- this may help others get randr initialized:

(require 'exwm)
(require 'exwm-randr)
(exwm-randr-enable)
(exwm-init)