2

I am running emacs under (Ubuntu under) WSL 2 and I can bring up the first frame maximized (i.e. almost full screen, leaving the Windows "task bar" exposed, the -mm option does that). I would like to bring up other frames the same way, so that by switching tasks on the task bar, I see only one Emacs frame. I can do this by creating a window and clicking on the maximize button, but I would like to do it within Emacs (using make-frame) because I layout the emacs windows/buffers based upon the frame real estate and doing it as two steps gets the internal windows slightly the wrong size.

In the old X days, I could do it with geometry frame-parameters, but WSL 2 doesn't seem to respect the top and left parameters and makes a frame where the maximize button is outside the display area so I cannot even click on it without first moving the window and then clicking. Moreover, I'm not certain that the geometry I am specifying is exactly the right size, which may be exacerbating the problem.

1

2 Answers 2

4

The variable default-frame-alist controls the frame dimensions. To have any new frame maximized write

(add-to-list 'default-frame-alist '(fullscreen . maximized))

in your init.el. See the official documentation for details.

1
  • The documentation now lists many more parameters than the list time I played with frames. Jun 26, 2021 at 18:27
3

@matteol tells you how to get the effect you want for all frames, by default.

To answer just your question about creating a frame with make-frame, either of these may help (they don't need to be interactive):

(defun my-make-frame ()
  "..."
  (interactive)
  (let ((default-frame-alist  '((fullscreen . maximized))))
    (make-frame)))

(defun my-make-frame ()
  "..."
  (interactive)
  (let ((default-frame-alist  ()))
    (make-frame '((fullscreen . maximized)))))

The value of default-frame-alist supplements whatever frame-parameters alist you pass to make-frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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