complete-computing-environment/appearance.org

12 KiB

Themeing my Emacs and Desktop

Themeing my Emacs

(provide 'cce/appearance)

I generally prefer dark and muted colors for the computers that I use. Barring e-paper, modern displays are forced to be needlessly bright for most conditions because of poorly glass displays perform under bright light. Dark themes work to off-set this, or at least that's the placebo effect. At least for me, it leads to far less intense light stimulation, especially when paired with follow-the-sun display tuning through Clight.

Right now, I am experimenting with using some themes from the Doom Themes or ef-themes repositories, trying to find an earthy natural theme which I can use also on my web sites.

I load a dark theme and a light theme, manegarm and acario-light ef-autumn and ef-spring respectively.

(load custom-file)
;; (use-package doom-themes
;;   :ensure t
;;   :demand
;;   :config
;;   (load-theme 'doom-manegarm t)
;;   (load-theme 'doom-opera-light t t))

(use-package ef-themes
  :ensure t
  :demand
  :config
  (load-theme 'ef-autumn t)
  (load-theme 'ef-spring t t))

I don't use my mouse very often so things like icon-bars and scroll-bars aren't useful to me. The modeline contains the buffer's progress, and I don't actually use the scrollbar to navigate. This leaves a tiny bit more room for the fringe and the buffers, which I consider a win.

(menu-bar-mode 0)
(when (functionp 'tool-bar-mode) (tool-bar-mode 0))
(when (functionp 'scroll-bar-mode) (scroll-bar-mode 0))
(column-number-mode -1)
(line-number-mode -1)
(setq x-stretch-cursor t)
(setq visible-bell t)
(with-eval-after-load "diminish"
  (diminish 'buffer-face-mode)
  (diminish 'evil-collection-unimpaired-mode))

Set cursor for each evil-state based on Doom Theme colors

Use the Doom Themes colors for cursors… I'm doing this myself because the Emacs state is the same as the Normal Mode state is the same, which isn't great!!

(defmacro cce/extract-doom-color (state color shape)
  `(setq ,(intern (concat "evil-" (symbol-name state) "-state-cursor"))
         (list ,(elt (alist-get color (ef-themes--current-theme-palette)) 0) ,shape)))

(cce/extract-doom-color emacs yellow 'box)
(cce/extract-doom-color normal blue-cooler 'box)
(cce/extract-doom-color visual green-warmer 'box)
(cce/extract-doom-color insert yellow-warmer 'box)
(cce/extract-doom-color replace yellow-warmer 'hollow)
(cce/extract-doom-color operator blue-warmer 'hollow)

Setting Emacs font default preferences, tweaking face attributes

Here is a set of functions for CCE which set up my font preferences based on the specifics of the computer I am using, and set a font which scales to the DPI to roughly 0.25 inch pitch. This uses functionality from External Display Test Functions to intuit which displays are in play.

(add-hook 'prog-mode-hook (lambda () (variable-pitch-mode -1)))
(add-hook 'text-mode-hook (lambda () (variable-pitch-mode 1)))

(eval-when-compile (require 'cl))
(defun cce/set-font-scale (size)
  (interactive "nWhat font size do you want? ")
  (set-face-attribute 'mode-line nil :inherit 'fixed-pitch :height (+ 10 size))
  (lexical-let ((size size))
    (with-eval-after-load 'org (set-face-attribute 'org-block nil :inherit 'fixed-pitch))
    (with-eval-after-load 'linum (set-face-attribute 'linum nil :inherit 'default :height size)))
  (set-face-attribute 'default nil        :height size)
  ;; (set-face-attribute 'fixed-pitch nil)
  (set-face-attribute 'variable-pitch nil :slant 'oblique :height size)
  (cce/enable-ipaex-font (/ size 3)))

Tweak font scaling based on display DPI

This calculates the DPI of external displays, assuming they report their physical size to RandR. Evaluating this requires my Japanese Study module to load, I should reorganize these and add a #+ARROYO_MODULE_WANTS sooner rather than later…

(add-hook 'after-cce-hook #'cce/refresh-display-scale)
(use-package dash)
(defun cce/refresh-display-scale ()
  (interactive)
  (cond ((not (cce/has-display-frames)) nil)
        ((equal (system-name) "window-smoke") (cce/set-font-scale 110))
        ((equal (system-name) "rose-quine") (cce/set-font-scale 125))
        ((cce/external-display-connected) (-> (cce/external-display-dpis)
                                              (first)
                                              (cdr)
                                              (* 0.80)
                                              (floor)
                                              (cce/set-font-scale)))
        ((equal (system-name) "tres-ebow") (cce/set-font-scale 125))
        ((equal (system-name) "solitary-living") (cce/set-font-scale 105))
        ((equal (system-name) "MeadowCrush") (cce/set-font-scale 110))
        (t (cce/set-font-scale 105))))

Installing free fonts fonts in My NixOS configuration

I use Vulfpeck Fonts, mostly, but have some other "standard" free fonts installed.

{ pkgs, lib, ... }:

{
  fonts = {
    fontDir.enable = true;
    fontconfig.enable = true;
    fonts = [
      pkgs.noto-fonts
      pkgs.noto-fonts-cjk
      (pkgs.nerdfonts.override {
         fonts = [
           "DejaVuSansMono"
           "DroidSansMono"
           "FiraCode"
           "OpenDyslexic"
           "SourceCodePro"
           "Terminus"
         ];
      })
      pkgs.xkcd-font
    ];
  };
}

DONE remove the dpi hack

SCHEDULED: <2021-09-11 Sat>

  • State "DONE" from "NEXT" [2021-10-05 Tue 20:49]

https://github.com/NixOS/nixpkgs/pull/133303

KDE Default Appearance Configuration using declarative kwriteconfig5

These are some reasonable defaults for KDE applications, extracted from this table and placed in to a Nix derivation and compiled in to a home-manager configuration with Arroyo.

file group key value <30>
kwinrc Compositing OpenGLIsUnsafe false
dolphinrc General FilterBar true Ctrl-i bound here by default
dolphinrc General BrowseThroughArchives true Browse in to zip, etc; I use "Extract To" context menu option for full extraction instead of invoking ark
dolphinrc General ConfirmClosingMultipleTabs false Always fresh Dolphin
dolphinrc General RememberOpenedTabs false Always fresh Dolphin
kdeglobals General fixed Vulf Mono,10,-1,5,50,0,0,0,0,0 Vulfpeck Fonts are Fun
kdeglobals General font Vulf Sans,10,-1,5,50,0,0,0,0,0 Vulfpeck Fonts are Fun
kdeglobals General menuFont Vulf Sans,10,-1,5,50,0,0,0,0,0 Vulfpeck Fonts are Fun
kdeglobals General smallestReadableFont Vulf Sans,8,-1,5,50,0,0,0,0,0 Vulfpeck Fonts are Fun
kdeglobals General toolbarFont Vulf Sans,8,-1,5,50,0,0,0,0,0 Vulfpeck Fonts are Fun
kdeglobals General activeFont Vulf Sans,8,-1,5,50,0,0,0,0,0 Vulfpeck Fonts are Fun
breezerc Windeco ButtonSize ButtonSmall
breezerc Windeco Exception 0 Enabled true Hide window decorations
breezerc Windeco Exception 0 ExceptionPattern .* Hide window decorations
breezerc Windeco Exception 0 ExceptionType 1 Hide window decorations
breezerc Windeco Exception 0 Mask 0 Hide window decorations
breezerc Windeco Exception 0 BorderSize 0 Hide window decorations
breezerc Windeco Exception 0 HideTitleBar true Hide window decorations

This table is transformed in to entries in a Nix attrset here:

(->> tbl
 (--map (apply (apply-partially #'format "%s.\"%s\".\"%s\" = \"%s\"; # %s") it))
 (s-join "\n"))

And inserted in to a kconfig generator here:

{ pkgs, config, ... }:

{
  home.activation.kconfigAppearance = pkgs.lib.mkKwriteConfig5 config {
    <<appearance_str()>>
  };
}

And included in my Arroyo distribution CCE