ch11ng / exwm

Emacs X Window Manager
2.85k stars 136 forks source link

exwm-layout-toggle-fullscreen not working inside functions #741

Open emysliwietz opened 4 years ago

emysliwietz commented 4 years ago

A function such as the following has no effect, while invoking exwm-layout-toggle-fullscreen manually using M-x does set the window to fullscreen (or ends fullscreen). Interestingly, exwm-layout-set-fullscreen does work when invoked like this.

(defun test-full ()
    (interactive)
    (exwm-layout-toggle-fullscreen))

I'm not sure if I'm missing some part of the documentation. The correct window is focused, otherwise exwm-layout-set-fullscreen wouldn't work.

My goal is to provide a shortcut to toggle the current buffer into fullscreen that works for both exwm and text buffers.

(defun toggle-maximize-buffer () "Maximize buffer"
       (if (= 1 (length (window-list)))
       (jump-to-register '_)
     (progn
       (window-configuration-to-register '_)
       (delete-other-windows))))

  (defun fullscreen ()
    (interactive)
    (if (eq major-mode 'exwm-mode)
    (exwm-layout-toggle-fullscreen)
        (toggle-maximize-buffer)))

  (setq exwm-input-global-keys
      `(([?\s-r] . exwm-reset)
    ([?\s-f] . fullscreen)
...
medranocalvo commented 4 years ago

That command needs a partial rewrite. Moreover, we should standardize how the various commands identify the "current X window"; right now we have a mix of window-buffer and (derived-mode-p 'exwm-mode).

In general, if you want to invoke a command in the same way it would be invoked by a key binding you should use:

(call-interactively 'exwm-layout-toggle-fullscreen)

You can use that as a workaround.

Please, leave the ticket open, so that we remember to improve these commands.

emysliwietz commented 4 years ago

Thank you. Not sure if this warrants another issue, so I'll just ask here:

  1. Keys like M-x or C-x b do not work when an X window is full-screened
  2. When I fullscreen an X window, two things happen. The window occupies the entire screen and the window sets itself to fullscreen (e.g. firefox hides the menu bar, just like when pressing F11). Is there a way to only do the first action without changing the state of the window?
medranocalvo commented 4 years ago

Hello @emysliwietz, yes, please, open a new ticket. I think the requests are kind of edge cases but, why not?