Function: frame-geometry

frame-geometry is a byte-compiled function defined in frame.el.gz.

Signature

(frame-geometry &optional FRAME)

Documentation

Return geometric attributes of FRAME.

FRAME must be a live frame and defaults to the selected one. The return value is an association list of the attributes listed below. All height and width values are in pixels.

outer-position is a cons of the outer left and top edges of FRAME
  relative to the origin - the position (0, 0) - of FRAME's display.

outer-size is a cons of the outer width and height of FRAME. The
  outer size includes the title bar and the external borders as well as
  any menu and/or tool bar of frame.

external-border-size is a cons of the horizontal and vertical width of
  FRAME's external borders as supplied by the window manager.

title-bar-size is a cons of the width and height of the title bar of
  FRAME as supplied by the window manager. If both of them are zero,
  FRAME has no title bar. If only the width is zero, Emacs was not
  able to retrieve the width information.

menu-bar-external, if non-nil, means the menu bar is external (never
  included in the inner edges of FRAME).

menu-bar-size is a cons of the width and height of the menu bar of
  FRAME.

tool-bar-external, if non-nil, means the tool bar is external (never
  included in the inner edges of FRAME).

tool-bar-position tells on which side the tool bar on FRAME is and can
  be one of left, top, right or bottom. If this is nil, FRAME
  has no tool bar.

tool-bar-size is a cons of the width and height of the tool bar of
  FRAME.

internal-border-width is the width of the internal border of
  FRAME.

Probably introduced at or before Emacs version 25.1.

Source Code

;; Defined in /usr/src/emacs/lisp/frame.el.gz
(defun frame-geometry (&optional frame)
  "Return geometric attributes of FRAME.
FRAME must be a live frame and defaults to the selected one.  The return
value is an association list of the attributes listed below.  All height
and width values are in pixels.

`outer-position' is a cons of the outer left and top edges of FRAME
  relative to the origin - the position (0, 0) - of FRAME's display.

`outer-size' is a cons of the outer width and height of FRAME.  The
  outer size includes the title bar and the external borders as well as
  any menu and/or tool bar of frame.

`external-border-size' is a cons of the horizontal and vertical width of
  FRAME's external borders as supplied by the window manager.

`title-bar-size' is a cons of the width and height of the title bar of
  FRAME as supplied by the window manager.  If both of them are zero,
  FRAME has no title bar.  If only the width is zero, Emacs was not
  able to retrieve the width information.

`menu-bar-external', if non-nil, means the menu bar is external (never
  included in the inner edges of FRAME).

`menu-bar-size' is a cons of the width and height of the menu bar of
  FRAME.

`tool-bar-external', if non-nil, means the tool bar is external (never
  included in the inner edges of FRAME).

`tool-bar-position' tells on which side the tool bar on FRAME is and can
  be one of `left', `top', `right' or `bottom'.  If this is nil, FRAME
  has no tool bar.

`tool-bar-size' is a cons of the width and height of the tool bar of
  FRAME.

`internal-border-width' is the width of the internal border of
  FRAME."
  (let* ((frame (window-normalize-frame frame))
	 (frame-type (framep-on-display frame)))
    (cond
     ((eq frame-type 'x)
      (x-frame-geometry frame))
     ((eq frame-type 'w32)
      (w32-frame-geometry frame))
     ((eq frame-type 'ns)
      (ns-frame-geometry frame))
     (t
      (list
       '(outer-position 0 . 0)
       (cons 'outer-size (cons (frame-width frame) (frame-height frame)))
       '(external-border-size 0 . 0)
       '(outer-border-width . 0)
       '(title-bar-size 0 . 0)
       '(menu-bar-external . nil)
       (let ((menu-bar-lines (frame-parameter frame 'menu-bar-lines)))
	 (cons 'menu-bar-size
	       (if menu-bar-lines
		   (cons (frame-width frame) 1)
		 1 0)))
       '(tool-bar-external . nil)
       '(tool-bar-position . nil)
       '(tool-bar-size 0 . 0)
       '(tab-bar-size 0 . 0)
       (cons 'internal-border-width
	     (frame-parameter frame 'internal-border-width)))))))