Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I detect the display size/resolution in Emacs?

I'd like to change the window/frame size of my XEmacs based on the current display resolution.

This is useful when I run my laptop either by itself or attached to a docking station with an external monitor. In either situation, I'd like Emacs to detect the primary screen resolution and adjust its main window frame size accordingly when I start it up.

like image 936
David R Tribble Avatar asked Jan 28 '10 00:01

David R Tribble


2 Answers

For a more cross-platform solution, look at

(display-pixel-width)
(display-pixel-height)

If what you actually want to do is set the Emacs window to full screen on start-up, check out maxframe.el.

like image 61
sanityinc Avatar answered Sep 21 '22 03:09

sanityinc


The current display resolution is available using the following functions (both non-interactive).

(x-display-pixel-width)
(x-display-pixel-height)
like image 40
Derek Slager Avatar answered Sep 22 '22 03:09

Derek Slager