Created
July 14, 2021 03:57
-
-
Save jclosure/8cf9ba2de9386d75aa2c27a6315bf915 to your computer and use it in GitHub Desktop.
Emacs set font-size based on monitor size.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; set some defaults | |
(setq my-font-name "monospace") | |
(setq my-font-size 10) | |
;; this method seems to work on gui systems only | |
(when window-system | |
(if (eq system-type 'darwin) | |
(setq my-font-name "Meslo")) | |
(if (eq system-type 'gnu/linux) | |
(setq my-font-name "FiraCode")) | |
(if (> (x-display-pixel-width) 1600) | |
(setq my-font-size 16)) | |
(if (<= (x-display-pixel-width) 1600) | |
(setq my-font-size 11))) | |
;; set the font | |
(set-frame-font (format "%s %d" my-font-name my-font-size)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment