1
0
Fork 0
mirror of https://git.sr.ht/~ryuslash/yoshi-theme synced 2025-01-31 03:15:52 +01:00

Add ‘yoshi-mode-line’ module

This is an experiment to see if I can customize the mode-line in a nice way.
This commit is contained in:
Tom Willemse 2023-08-01 10:41:16 -07:00
parent 11c37ef4ef
commit 61e4250ae3
13 changed files with 83 additions and 14 deletions

View file

@ -10,6 +10,10 @@ This project adheres to [[http://semver.org][Semantic Versioning]].
* COMMENT [[https://github.com/ryuslash/yoshi-theme/compare/v7.0.0...HEAD][Unreleased]] * COMMENT [[https://github.com/ryuslash/yoshi-theme/compare/v7.0.0...HEAD][Unreleased]]
** REMOVED Hacks for the mode-line
** ADDED Custom mode-line module yoshi-mode-line
* [[https://github.com/ryuslash/yoshi-theme/compare/v6.2.0...v7.0.0][7.0.0]] -- 2023-08-01 * [[https://github.com/ryuslash/yoshi-theme/compare/v6.2.0...v7.0.0][7.0.0]] -- 2023-08-01
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: release-7.0.0 :CUSTOM_ID: release-7.0.0

View file

@ -82,6 +82,10 @@ Once you've installed Yoshi theme you can either use =M-x load-theme= to enable
(load-theme 'yoshi :no-confirm) (load-theme 'yoshi :no-confirm)
#+END_SRC #+END_SRC
*** Other modules
- yoshi-mode-line :: Enable this by calling ~(require 'yoshi-mode-line)~. This module enables the mode-line as is intended to be used with Yoshi theme.
** Installation in Spacemacs ** Installation in Spacemacs
Edit your .spacemacs file ~(SPC f e d)~ and add the ~yoshi-theme~ package: Edit your .spacemacs file ~(SPC f e d)~ and add the ~yoshi-theme~ package:

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384v38.6C310.1 219.5 256 287.4 256 368c0 59.1 29.1 111.3 73.7 143.3c-3.2 .5-6.4 .7-9.7 .7H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM288 368a144 144 0 1 1 288 0 144 144 0 1 1 -288 0zm224 0c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16s7.2 16 16 16H496c8.8 0 16-7.2 16-16z"/></svg>

After

Width:  |  Height:  |  Size: 578 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V160H256c-17.7 0-32-14.3-32-32V0H64zM256 0V128H384L256 0zM153 289l-31 31 31 31c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L71 337c-9.4-9.4-9.4-24.6 0-33.9l48-48c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9zM265 255l48 48c9.4 9.4 9.4 24.6 0 33.9l-48 48c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l31-31-31-31c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0z"/></svg>

After

Width:  |  Height:  |  Size: 661 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V160H256c-17.7 0-32-14.3-32-32V0H64zM256 0V128H384L256 0zM112 256H272c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H272c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H272c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16z"/></svg>

After

Width:  |  Height:  |  Size: 622 B

1
icons/file-pen-solid.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V285.7l-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"/></svg>

After

Width:  |  Height:  |  Size: 696 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384v47l-92.8 37.1c-21.3 8.5-35.2 29.1-35.2 52c0 56.6 18.9 148 94.2 208.3c-9 4.8-19.3 7.6-30.2 7.6H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zm39.1 97.7c5.7-2.3 12.1-2.3 17.8 0l120 48C570 277.4 576 286.2 576 296c0 63.3-25.9 168.8-134.8 214.2c-5.9 2.5-12.6 2.5-18.5 0C313.9 464.8 288 359.3 288 296c0-9.8 6-18.6 15.1-22.3l120-48zM527.4 312L432 273.8V461.7c68.2-33 91.5-99 95.4-149.7z"/></svg>

After

Width:  |  Height:  |  Size: 689 B

1
icons/file-solid.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128z"/></svg>

After

Width:  |  Height:  |  Size: 381 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M88.7 223.8L0 375.8V96C0 60.7 28.7 32 64 32H181.5c17 0 33.3 6.7 45.3 18.7l26.5 26.5c12 12 28.3 18.7 45.3 18.7H416c35.3 0 64 28.7 64 64v32H144c-22.8 0-43.8 12.1-55.3 31.8zm27.6 16.1C122.1 230 132.6 224 144 224H544c11.5 0 22 6.1 27.7 16.1s5.7 22.2-.1 32.1l-112 192C453.9 474 443.4 480 432 480H32c-11.5 0-22-6.1-27.7-16.1s-5.7-22.2 .1-32.1l112-192z"/></svg>

After

Width:  |  Height:  |  Size: 593 B

1
icons/folder-solid.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 480H448c35.3 0 64-28.7 64-64V160c0-35.3-28.7-64-64-64H288c-10.1 0-19.6-4.7-25.6-12.8L243.2 57.6C231.1 41.5 212.1 32 192 32H64C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64z"/></svg>

After

Width:  |  Height:  |  Size: 423 B

1
icons/terminal-solid.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M9.4 86.6C-3.1 74.1-3.1 53.9 9.4 41.4s32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L178.7 256 9.4 86.6zM256 416H544c17.7 0 32 14.3 32 32s-14.3 32-32 32H256c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>

After

Width:  |  Height:  |  Size: 501 B

66
yoshi-mode-line.el Normal file
View file

@ -0,0 +1,66 @@
;;; yoshi-mode-line.el --- Custom mode-line settings for Yoshi theme -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords:
;; 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:
;; This module defines the mode-line that is meant to be used with with the
;; yoshi-theme theme. This module is heavily inspired by the nano-modeline
;; module from the nano-emacs project.
;;; Code:
(defconst yoshi-mode-line-root
(file-name-directory
(or load-file-name
(buffer-file-name)))
"The directory where yoshi-mode-line was loaded from.")
(defconst yoshi-mode-line-icons-dir
(expand-file-name "icons" yoshi-mode-line-root)
"The directory where yoshi-mode-line stores its icons.")
;;; These files were all downloaded from the Font Awesome website.
(defun yoshi-mode-line-buffer-status-display ()
"Display an icon for the status of the buffer."
(cond
((derived-mode-p 'comint-mode 'eshell-mode)
(propertize "term" 'display `(image :type svg :file ,(expand-file-name "terminal-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))
((derived-mode-p 'wdired-mode)
(propertize "wdired" 'display `(image :type svg :file ,(expand-file-name "folder-open-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))
((derived-mode-p 'dired-mode)
(propertize "dired" 'display `(image :type svg :file ,(expand-file-name "folder-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))
((null buffer-file-name)
(propertize "no-file" 'display `(image :type svg :file ,(expand-file-name "file-circle-minus-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))
((buffer-modified-p)
(propertize "modified" 'display `(image :type svg :file ,(expand-file-name "file-pen-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))
(buffer-read-only
(propertize "read-only" 'display `(image :type svg :file ,(expand-file-name "file-shield-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))
((derived-mode-p 'prog-mode)
(propertize "code" 'display `(image :type svg :file ,(expand-file-name "file-code-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))
((derived-mode-p 'text-mode)
(propertize "text" 'display `(image :type svg :file ,(expand-file-name "file-lines-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))
(t
(propertize "read-write" 'display `(image :type svg :file ,(expand-file-name "file-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height))))))
(setq-default mode-line-format
`("%e" mode-line-front-space (:eval (yoshi-mode-line-buffer-status-display)) ,@(cdr (default-value 'mode-line-format))))
(provide 'yoshi-mode-line)
;;; yoshi-mode-line.el ends here

View file

@ -32,20 +32,6 @@
(deftheme yoshi (deftheme yoshi
"Created 2012-09-24") "Created 2012-09-24")
(defun yoshi-theme-add-space-to-first-arg (args)
"Return ARGS with the car modified to contain 2 spaces."
(cons (format " %s " (car args)) (cdr args)))
(defun yoshi-theme-add-spaces-around-current-info-node (func &rest args)
(let ((Info-current-node (format " %s " Info-current-node)))
(apply func args)))
(advice-add 'propertized-buffer-identification
:filter-args #'yoshi-theme-add-space-to-first-arg)
(advice-add 'Info-set-mode-line
:around #'yoshi-theme-add-spaces-around-current-info-node)
(defun yoshi-theme--make-inline-box (border-color) (defun yoshi-theme--make-inline-box (border-color)
"Return a list representing a box specification using BORDER-COLOR." "Return a list representing a box specification using BORDER-COLOR."
(let ((line-width (if (> emacs-major-version 27) (let ((line-width (if (> emacs-major-version 27)