0

I want to center the emacs frame on the monitor. What can I do? I do have multiple monitors.

This is what I am doing, but the emacs frame gets displayed on a different monitor than from the monitor from which I launched emacs.

(typex-inhibit-startup-windows)
(setq initial-frame-alist '((width . 75) (height . 21)))
(set-face-attribute 'default nil :height 160 :weight 'bold)

I know there is (frame-monitor-attributes) but do not know how I can use the information.

Have done the following function

(defun frame-center (&optional frame)
  "Center FRAME on the screen.
FRAME can be a frame name, a terminal name, or a frame.
If FRAME is omitted or nil, use currently selected frame."
  (interactive)
  (unless (eq 'maximised (frame-parameter nil 'fullscreen))
    (modify-frame-parameters frame
       '((user-position . t)
     (bottom . 0.5) (right . 0.5)))))

which I call with

(setq frame-inhibit-implied-resize t)
(frame-center)
(setq frame-inhibit-implied-resize nil)

Am trying to play a little bit with the values and would like to ask what the value 0.5 represents.

Dilna
  • 1,173
  • 3
  • 10

0 Answers0