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.

intel_chris
  • 329
  • 2
  • 12
  • 1
    `make-frame` can take arguments to control how the frame is created: https://emacs.stackexchange.com/a/17354/2287 – lawlist Jun 26 '21 at 15:20

2 Answers2

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.

matteol
  • 1,868
  • 1
  • 9
  • 11
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.

NickD
  • 27,023
  • 3
  • 23
  • 42
Drew
  • 75,699
  • 9
  • 109
  • 225