3

The command #'toggle-frame-fullscreen does exactly what it says; it toggles between fullscreen and not.

What command can I run to make sure the frame is fullscreen? That is, if not fullscreen, make it fullscreen; if already fullscreen, don't do anything.

zck
  • 8,984
  • 2
  • 31
  • 65
  • 4
    It is the first line of code after the `interactive` statement -- i.e., evaluate `(frame-parameter nil 'fullscreen)`. If not fullscreen, then it will return `nil`. To see what is happening, type `M-x find-function RET toggle-frame-fullscreen RET` – lawlist Dec 28 '16 at 01:18
  • 3
    I found an exception to the above-mentioned comment in the case of a `maximized` frame (but not full screen). Here is a revised test that will return `nil` if the frame is `maximized` (or less), or `t` if it is fullscreen: `(memq (frame-parameter nil 'fullscreen) '(fullscreen fullboth))` – lawlist Dec 28 '16 at 01:31

1 Answers1

3

Properties of frames are called frame parameters. Whether a frame is maximized this way or not is controlled by the 'fullscreen parameter. We want this parameter to be 'fullboth. And we can set a frame parameter using #'set-frame-parameter.

So here's code to make sure the 'fullscreen parameter is 'fullboth:

(set-frame-parameter nil 'fullscreen 'fullboth)
zck
  • 8,984
  • 2
  • 31
  • 65