elisp - Get width of current monitor in Emacs Lisp -


i have two-monitor setup (running ubuntu).

the emacs lisp function display-pixel-width gives me combined width of 2 monitors. how can width of current monitor (i.e., monitor displaying current frame)?

if using released version:

display-pixel-width compiled lisp function in `frame.el'.

(display-pixel-width &optional display)

return width of display's screen in pixels. character terminals, each character counts single pixel.

additionally, if using development version (to released 24.4):

** multi-monitor support has been added.

*** new functions display-monitor-attributes-list , frame-monitor-attributes can used obtain information each physical monitor on multi-monitor setups.

use external process

you can parse output of xwininfo or xrandr (use call-process).

maximize emacs

finally, can maximize emacs (either interactively or using modify-frame-parameters; next version 24.4 has toggle-frame-fullscreen , toggle-frame-maximized) , query frame size using frame-pixel-height , frame-pixel-width.

see also

  1. how find display size of system in emacs?
  2. can detect display size/resolution in emacs?

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -