Is it possible (using only emacs-lisp) to find out if the current frame is maximized?

Not fullscreen, but maximized.

  • Here is one idea: (assq 'outer-size (frame-geometry)); (assq 'title-bar-size (frame-geometry)); and (assq 'tool-bar-size (frame-geometry)). See also: gnu.org/software/emacs/manual/html_node/elisp/Frame-Size.html – lawlist Jul 16 '19 at 22:23
  • Did you try (eq (frame-parameter nil 'fullscreen) 'maximized)? See (elisp) Size Parameters. – Drew Jul 17 '19 at 0:35
  • @Drew sadly, this appears to be not working in OSX (Emacs 27 Cocoa), it just returns nil whether it's maximized or not – iLemming Jul 17 '19 at 4:24
  • @Drew I stand corrected: I just re-installed latest from master and (frame-parameter nil 'fullscreen) does return 'maximized. Maybe it was broken and fixed recently, or something else. Would you please post this as an answer? – iLemming Jul 17 '19 at 4:49
  • Although the call of the question seeks a pure emacs-lisp solution, here is a link to an emacs-lisp function that incorporates an applescript to get the bounds of the selected frame. gist.github.com/d7000235c8510460079149ad25233f0d Assuming the user knows the dimensions of what a maximized frame would be, that can be compared to the output of the get-bounds function. – lawlist Jul 17 '19 at 5:04

This should work, as the test you want:

(eq (frame-parameter nil 'fullscreen) 'maximized)

See (elisp) Size Parameters.

| improve this answer | |

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.