On 9/27/23 15:25, Emanuel Berg wrote:
David Hedlund wrote:

sudo apt install -y emacs wmctrl # Just press Enter during the
"Postfix Configuration"

tee ~/.emacs > /dev/null << 'EOF'

(defun switch-full-screen ()
       (interactive)
       (shell-command "wmctrl -r :ACTIVE: -b toggle,fullscreen"))

EOF
Yes, do that and then M-x switch-full-screen RET

or just type

  (shell-command "wmctrl -r :ACTIVE: -b toggle,fullscreen")

and do C-x C-e for `eval-last-sexp'.

It doesn't work?


Sorry, it works, I just expected the snippet from Emacs wiki to work out-of-the-box automatically. But I had to add: (add-hook 'after-init-hook 'switch-full-screen)  . Also, "toggle" is useless for wmctrl in this situation, so I replaced it with "add", and I replaced "fullscreen" with "maximized_horz,maximized_vert"

Here's the final solution for X11 (Trisquel, Ubuntu MATE), but not for Wayland (Ubuntu):
(defun switch-full-screen ()
       (interactive)
       (shell-command "wmctrl -r :ACTIVE: -b add,maximized_horz,maximized_vert"))


This is a very compact and useful solution. Again, I suggest it to be documented in the Emacs Manual in a new page: https://www.gnu.org/software/emacs/manual/html_node/efaq/Fullscreen-mode-on-GNU-Linux.html

Again, the devilspie2 solution is much longer, can be used for both X11 and Wayland.