On 9/27/23 13:21, David Hedlund wrote:


On 9/27/23 00:33, Emanuel Berg wrote:
David Hedlund wrote:

Thank you, but none of the solutions worked in Trisquel 11
(X11)
$ wmctrl -r :ACTIVE: -b toggle,maximized_horz,maximized_vert

To always set, use 'add' instead of 'toggle'. To always unset,
use 'remove'.

Thank you, this is exactly what I want! It expands the window quickly (like emacs -mm) from the terminal.


* This works from the terminal with an open emacs Window: $ wmctrl -i -r "0x06400142" -b toggle,maximized_vert,maximized_horz


* However     shell-command "wmctrl... doesn't not run from ~/.emacs (tried it in a fresh Trisquel 11 installation from a virtual machine), the window size is opened in the default size:

---
Failed the settings suggested by Björn Bidar (as I mentioned earlier):

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

---


Failed with the command that is working from the terminal (escaped double quotes, and made sure that the window is open and that the window ID is correct):

(defun switch-full-screen ()
       (interactive)
       (shell-command "wmctrl -i -r \"0x06400142\" -b toggle,maximized_vert,maximized_horz"))

---


Failed:

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


---

Any idea why shell-command is not executed?


It also fails in Ubuntu MATE 23.04 (default window size):

-------------------------8<-----------------------------

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


emacs

-------------------------8<-----------------------------