I have a two-monitor setup (running Ubuntu).
The Emacs Lisp function display-pixel-width gives me the combined width of the two monitors. How can I get the width of the current monitor (i.e., the monitor displaying the current frame)?
display-pixel-width is a compiled Lisp function in `frame.el'.
(display-pixel-width &optional DISPLAY)
Return the width of DISPLAY's screen in pixels. For character terminals, each character counts as a single pixel.
** Multi-monitor support has been added.
*** New functions
display-monitor-attributes-list
andframe-monitor-attributes
can be used to obtain information about each physical monitor on multi-monitor setups.
You can also parse the output of xwininfo
or xrandr
(use call-process
).
Finally, you can maximize emacs (either interactively or using modify-frame-parameters
; version 24.4 also has toggle-frame-fullscreen
and toggle-frame-maximized
) and query its frame size using frame-pixel-height
and frame-pixel-width
.