2

It's possible to add a line to one's .emacs

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

that will make make-frame-command (C-x 5 2) spawn maximized windows.

It's also possible to distinguish this customization

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

for the initial and the default frames.

I would like the customization to be based instead on whether I'm using an external monitor.

  • If I'm using the laptop's built-in display, I'd like the (initial and default) frames to be maximized.
  • If I've connected the laptop to an external display, I'd like the (initial and default) frames to use only 60% of the width and 60% of the height.

Is this possible? How?

A solution that only works on a MacBook is welcome and sufficient for me.

1

You can call (display-monitor-attributes-list), it will return a list where each element describe each monitor.

In your case, you can simply check the length of the list. If it contains one element you can configure Emacs for the built-in screen. If it contains two or more elements you can configure it for the external monitor.

An ambitious solution could look at the geometry of the monitors, but if you only use one you can hard-wire the frame size.

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.