2

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.

  • 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 1:18
  • 2
    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 1:31
2

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.