diff options
| author | 2025-01-15 14:14:19 -0800 | |
|---|---|---|
| committer | 2025-01-15 14:14:19 -0800 | |
| commit | de46dda0bcd75acde774806bd393761666860f80 (patch) | |
| tree | 42e76211834d4b8de63d2a77f996b480bfabebe1 /oni-gui | |
| parent | 835ece1ca9c08038e3953d7fe4a2a0a5a4332880 (diff) | |
| download | emacs-config-de46dda0bcd75acde774806bd393761666860f80.tar.gz emacs-config-de46dda0bcd75acde774806bd393761666860f80.zip | |
Replace isearch and auto-revert icons with SVG images
The font awesome fonts don't always work quite right, but SVG images are pretty
good to work with.
Diffstat (limited to 'oni-gui')
| -rw-r--r-- | oni-gui/icons/recycle.svg | 3 | ||||
| -rw-r--r-- | oni-gui/icons/search.svg | 3 | ||||
| -rw-r--r-- | oni-gui/oni-gui.el | 140 |
3 files changed, 146 insertions, 0 deletions
diff --git a/oni-gui/icons/recycle.svg b/oni-gui/icons/recycle.svg new file mode 100644 index 0000000..21d1bd9 --- /dev/null +++ b/oni-gui/icons/recycle.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-recycle" viewBox="0 0 16 16"> + <path d="M9.302 1.256a1.5 1.5 0 0 0-2.604 0l-1.704 2.98a.5.5 0 0 0 .869.497l1.703-2.981a.5.5 0 0 1 .868 0l2.54 4.444-1.256-.337a.5.5 0 1 0-.26.966l2.415.647a.5.5 0 0 0 .613-.353l.647-2.415a.5.5 0 1 0-.966-.259l-.333 1.242zM2.973 7.773l-1.255.337a.5.5 0 1 1-.26-.966l2.416-.647a.5.5 0 0 1 .612.353l.647 2.415a.5.5 0 0 1-.966.259l-.333-1.242-2.545 4.454a.5.5 0 0 0 .434.748H5a.5.5 0 0 1 0 1H1.723A1.5 1.5 0 0 1 .421 12.24zm10.89 1.463a.5.5 0 1 0-.868.496l1.716 3.004a.5.5 0 0 1-.434.748h-5.57l.647-.646a.5.5 0 1 0-.708-.707l-1.5 1.5a.5.5 0 0 0 0 .707l1.5 1.5a.5.5 0 1 0 .708-.707l-.647-.647h5.57a1.5 1.5 0 0 0 1.302-2.244z"/> +</svg>
\ No newline at end of file diff --git a/oni-gui/icons/search.svg b/oni-gui/icons/search.svg new file mode 100644 index 0000000..3318054 --- /dev/null +++ b/oni-gui/icons/search.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16"> + <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/> +</svg>
\ No newline at end of file diff --git a/oni-gui/oni-gui.el b/oni-gui/oni-gui.el new file mode 100644 index 0000000..7c6aca4 --- /dev/null +++ b/oni-gui/oni-gui.el @@ -0,0 +1,140 @@ +;;; oni-gui.el --- GUI settings for Emacs -*- lexical-binding: t; -*- + +;; Copyright (C) 2019 Tom Willemse + +;; Author: Tom Willemse <tom@ryuslash.org> +;; Keywords: local +;; Version: 2025.0115.141118 +;; Package-Requires: (oni-ui oni-hydra yoshi-theme diminish) + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; These are my GUI settings. + +;;; Code: + +(require 'hydra) +(require 'oni-ui) + +(defconst oni-gui-root + (file-name-directory + (or load-file-name + (buffer-file-name))) + "The directory where ‘oni-gui’ was loaded from.") + +(defconst oni-gui-icons-dir + (expand-file-name "oni-gui/icons" oni-gui-root) + "The directory where ‘oni-gui’ stores its icons.") + +(add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono-15")) +(add-to-list 'default-frame-alist '(internal-border-width . 15)) + +(defun oni-gui-setup-faces (frame) + "Setup faces for FRAME." + (set-face-attribute 'fixed-pitch frame :font "Fantasque Sans Mono-15") + (set-face-attribute 'variable-pitch frame :font "Comic Neue-15")) + +(defun oni-gui-setup-fontsets (frame) + "Setup fontsets for FRAME. +If FRAME is nil, they’re set for the current frame." + (let ((font-awesome "Font Awesome 5 Free Solid-12")) + (set-fontset-font t #xf026 font-awesome frame) + (set-fontset-font t #xf027 font-awesome frame) + (set-fontset-font t #xf028 font-awesome frame) + (set-fontset-font t #xf240 font-awesome frame) + (set-fontset-font t #xf241 font-awesome frame) + (set-fontset-font t #xf242 font-awesome frame) + (set-fontset-font t #xf243 font-awesome frame) + (set-fontset-font t #xf244 font-awesome frame) + (set-fontset-font t #xf2c9 font-awesome frame) + (set-fontset-font t #xf6a9 font-awesome frame) + (set-fontset-font t #xf769 font-awesome frame) + (set-fontset-font t #xf76b font-awesome frame)) + (let ((font-awesome "Font Awesome 5 Free Regular-12")) + (set-fontset-font t #xf0c8 font-awesome frame) + (set-fontset-font t #xf14a font-awesome frame)) + (let ((dejavu-sans-mono "DejaVu Sans Mono-12")) + (set-fontset-font t #x25c9 dejavu-sans-mono frame) + (set-fontset-font t #x25cb dejavu-sans-mono frame) + (set-fontset-font t #x2738 dejavu-sans-mono frame) + (set-fontset-font t #x273f dejavu-sans-mono frame) + (set-fontset-font t #x2713 dejavu-sans-mono frame))) + +;; Thanks to the article at +;; https://andreyorst.gitlab.io/posts/2020-07-21-programming-ligatures-in-emacs/ +(defun oni-gui-setup-ligatures (&optional _) + "Define ligatures supported by Fantasque Sans Mono." + (let ((ligatures + `((?= . ,(regexp-opt '("==" "===" "=/=" "=>" "==>" "=>>" "=<<"))) + (?! . ,(regexp-opt '("!=" "!=="))) + (?< . ,(regexp-opt '("<-<" "<<-" "<--" "<-" "<->" "<=<" "<<=" "<==" + "<=>" "<~>" "<~~" "<~" "<<<" "<<" "<=" "<>" + "<|||" "<||" "<|" "<|>" "<!--"))) + (?- . ,(regexp-opt '("->" "-->" "->>" "-<" "-<<"))) + (?> . ,(regexp-opt '(">->" ">=>" ">>=" ">>-" ">-" ">=" ">>" ">>>"))) + (?~ . ,(regexp-opt '("~~" "~>" "~~>"))) + (?| . ,(regexp-opt '("|>" "||>" "|||>" "||"))) + (?: . ,(regexp-opt '("::"))) + (?& . ,(regexp-opt '("&&"))) + (?/ . ,(regexp-opt '("//" "/*"))) + (?* . ,(regexp-opt '("*/" "**/")))))) + (dolist (char-regexp ligatures) + (set-char-table-range composition-function-table (car char-regexp) + `([,(cdr char-regexp) 0 font-shape-gstring]))))) + +(with-eval-after-load 'isearch + (diminish 'isearch-mode (propertize " " 'display `(image :type svg :file ,(expand-file-name "search.svg" oni-gui-icons-dir) :ascent center :margin (5 . 0))))) +(with-eval-after-load 'autorevert + (diminish 'auto-revert-mode (propertize " " 'display `(image :type svg :file ,(expand-file-name "recycle.svg" oni-gui-icons-dir) :ascent center :margin (5 . 0))))) + +(defhydra oni-gui-hydra (:color teal :hint nil) + " +^Buffer^ ^Packages^ ^Sort^ +^^^^^^----------------------------------- +_br_: Revert _pl_: List _sl_: Sort +_bi_: Auto Insert ^^ ^^ +" + ("br" (revert-buffer nil t)) + ("bi" auto-insert) + ("pl" list-packages) + ("sl" sort-lines)) + +(setq-default cursor-type '(bar . 2)) +(setq-default cursor-in-non-selected-windows 'box) +(setq frame-resize-pixelwise t) + +(scroll-bar-mode -1) + +(unless (eq system-type 'windows-nt) + (if (daemonp) + (progn + (add-hook 'after-make-frame-functions #'oni-gui-setup-ligatures) + (add-hook 'after-make-frame-functions #'oni-gui-setup-fontsets) + (add-hook 'after-make-frame-functions #'oni-gui-setup-faces)) + (oni-gui-setup-fontsets nil) + (oni-gui-setup-faces nil) + (oni-gui-setup-ligatures))) + +(global-unset-key (kbd "C-z")) +(global-set-key (kbd "C-c c") '("Frequently used commands" . oni-gui-hydra/body)) + +(load-theme 'yoshi :no-confirm) + +(when (fboundp 'pixel-scroll-precision-mode) + (pixel-scroll-precision-mode)) + +(provide 'oni-gui) +;;; oni-gui.el ends here |
