dotfiles/emacs-lisp/display_settings.org
magic_rb 29961182d4
emacs: add HDMI-1-1...
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-11-09 22:15:57 +01:00

3.8 KiB

Display Settings

Adjust the font, based on the specific host.

  (use-package isoevka-font
    :no-require t
    :init
    (defvar magic_rb/fixed-width-font "Iosevka Term Extended"
      "The font used for fixed width text.")
    (defvar magic_rb/variable-pitch-font "Iosevka Aile"
      "The font used for variable pitch text.")

    (defun magic_rb/apply-fonts (&optional frame)
      (interactive)
      (let ((frame (or frame (selected-frame)))
            (mon (alist-get 'name (frame-monitor-attributes (selected-frame))))
            (hostname (system-name)))
        (pcase hostname
          ("heater" (set-face-attribute 'default nil :family magic_rb/fixed-width-font :slant 'normal :height 105))
          ("omen"
           (pcase mon
             ((or "DP-1-3" "DP-1-3-6" "DP-1-3-5" "DP-1-0.5.5" "DP-1-0.6.6" "DP-1-3-6-6" "DP-1-3-5-5" "DP-1-0.6" "DP-1-0"
                  "DP-1-0.5" "DP-1-1" "HDMI-1-1")
              (set-face-attribute 'default frame :family magic_rb/fixed-width-font :slant 'normal :height 95))
             ((or "eDP-1" _)
              (set-face-attribute 'default frame :family magic_rb/fixed-width-font :slant 'normal :height 130)))))
        (set-face-attribute 'fixed-pitch nil :family magic_rb/fixed-width-font :slant 'normal :height 1.0)
        (set-face-attribute 'variable-pitch nil :family magic_rb/variable-pitch-font :height 1.0)))
    :config
    ;; (push 'magic_rb/apply-fonts window-size-change-functions)
    (push 'magic_rb/apply-fonts after-make-frame-functions))

Load Modus Vivendi, but change the background color to not-black, it's a bit less depressing and in my opinion nicer on the eyes.

  (use-package modus-vivendi-semi-black
    :no-require t
    :init
    (setq modus-vivendi-theme-override-colors-alist
          '(("bg-main" . "#111519"))))
  (use-package ef-themes
    :straight t)
  (use-package themes
    :no-require t
    :after (ef-themes)
    :config
    (load-theme 'modus-vivendi t t)
    (load-theme 'modus-operandi t t)
    (load-theme 'ef-winter t t)
    (load-theme 'ef-autumn t t)
    (load-theme 'ef-bio t t)
    (enable-theme 'ef-bio))
t

Enable doom-modeline, much better than the default and unlike powerline it's usable with TRAMP, so that's great.

    (use-package doom-modeline
      :straight t
      :config
      (doom-modeline-mode))

Only show buffer encoding conditionally, there's no reason to have LF UTF-8 down there, rather only show when the encoding is something we don't expect, like CRLF or UTF-16. Inspired by tecosaur.

  (use-package doom-modeline-conditional-buffer-encoding
    :no-require t
    :init
    (defun tecosaur/doom-modeline-conditional-buffer-encoding ()
      "We expect the encoding to be LF UTF-8, so only show the modeline when this is not the case"
      (setq-local doom-modeline-buffer-encoding
                  (unless (or (eq buffer-file-coding-system 'utf-8-unix)
                              (eq buffer-file-coding-system 'utf-8)))))

    :hook
    (after-change-major-mode-hook . tecosaur/doom-modeline-conditional-buffer-encoding))

Disable GTK decorations, they're not that great looking and I don't really want to have Emacs affected by GTK themes.

  (if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
  (menu-bar-mode -1)
  (scroll-bar-mode -1)

Load all-the-icons, it's required used by treemacs and doom-modeline. You also must run all-the-icons-install-fonts if you haven't already.

  (use-package all-the-icons
    :straight t)