Skip to content

Instantly share code, notes, and snippets.

@mattmc3
Created October 26, 2022 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattmc3/cd749dfbcf53d47af06baf181980c458 to your computer and use it in GitHub Desktop.
Save mattmc3/cd749dfbcf53d47af06baf181980c458 to your computer and use it in GitHub Desktop.
Emacs frame (window) re-center
;; https://christiantietze.de/posts/2022/04/emacs-center-window-current-monitor-simplified/
(defun my/frame-recenter (&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) (top . 0.5) (left . 0.5)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment