How can I maximize the current frame in an idempotent manner? That is to say, it maximizes the frame if it isn't, and leaves the frame maximized if it is?
-
Search first, then ask. – shynur Jul 12 '23 at 08:22
-
Also this one: https://emacs.stackexchange.com/questions/51392/how-do-i-toggle-between-current-frame-size-and-maximized-frame/ – rpluim Jul 12 '23 at 08:37
-
What is the difference between maximised and fullscreen ? – Dilna Jul 12 '23 at 09:16
-
1"*What is the difference between maximised and fullscreen ?*" -- Can't you google yourself? – shynur Jul 12 '23 at 09:28
-
I do not know the correct terminology, but maximised retains a bar at the top with an emacs logo. What is it ? – Dilna Jul 12 '23 at 10:17
1 Answers
As indicated in the comments, there are existing questions that lead the way to the answer to this one.
How do I toggle between current frame size and maximized frame teaches us that there is toggle-frame-maximized
.
How do I make sure a frame is fullscreen? teaches us that there is a function set-frame-parameter
.
When we look at the help for toggle-frame-maximized
with C-h f toggle-frame-maximized RET
, we see the following at the top:
toggle-frame-maximized is an interactive byte-compiled Lisp function in ‘frame.el’.
This tells us the function is written in elisp, so we can go look at the source code by clicking on frame.el
, right there.
When we go look at the source code for toggle-frame-maximized
, we see that it fundamentally is a conditional that has three possible calls to set-frame-parameter
.
In order to unconditionally maximize the current frame, all we need to do is the following:
(set-frame-parameter nil 'fullscreen 'maximized)
That's it.

- 2,375
- 21
- 34