load theme earlier, update awesome-tray

This commit is contained in:
2025-06-16 22:40:01 +02:00
parent 5a1ee56a85
commit 56022f7f8b
11 changed files with 1988 additions and 941 deletions

134
lisp/awesome-tray/README.md Normal file
View File

@@ -0,0 +1,134 @@
<img src="./screenshots/screenshot.png">
[More screenshots](./screenshots/README.md)
### What's this?
I don't like the mode-line, it's too high and affect me to read the code.
With Emacs, we only need to focus on very little information, such as time, current mode, git branch.
Excessive information can seriously interfere with our attention.
## Installation
Clone this repository
```console
$ git clone --depth=1 https://github.com/manateelazycat/awesome-tray.git
```
Then put awesome-tray.el to your load-path.
The load-path is usually `~/elisp/`. It's set in your `~/.emacs` like this:
```Elisp
(add-to-list `load-path (expand-file-name "~/elisp"))
(require 'awesome-tray)
(awesome-tray-mode 1)
```
## Customize Mode line.
- `awesome-tray-hide-mode-line`: Enabled by default, makes the mode-line very thin and highlight it when its active/inactive.
- `awesome-tray-mode-line-active-color`: Use for customize active color.
- `awesome-tray-mode-line-inactive-color`: Use for customize inactive color.
- `awesome-tray-adjust-mode-line-color-enable`: Disabled by default. If non-nil, adjust mode-line color when buffer state changes.
- `awesome-tray-mode-line-modified-readonly-color`: Use for customize modified and readonly color.
- `awesome-tray-mode-line-readonly-color`: Use for customize readonly color.
- `awesome-tray-mode-line-modified-color`: Use for customize modified color.
- `awesome-tray-mode-line-height`: Mode line height, default is 0.1
- `awesome-tray-date-format`: Use to customize the date string format.
- `awesome-tray-mpd-format`: Use to customize the mpd string format, see the variable docstring for details.
- `awesome-tray-git-format`: Use to customize the git string format.
- `awesome-tray-location-format`: Use to customize the location string format, see `mode-line-format`.
- `awesome-tray-location-info-all`: Use to customize the location "All", if `mode-line-format` contains `%p`.
- `awesome-tray-location-info-top`: Use to customize the location "Top", if `mode-line-format` contains `%p`.
- `awesome-tray-location-info-bottom`: Use to customize the location "Bottom", if `mode-line-format` contains `%p`.
- `awesome-tray-git-show-status`: If non-nil, show current file status on the git module.
- `awesome-tray-ellipsis`: Use to customize the ellipses used when truncating.
- `awesome-tray-separator`: Use to customize the separator between modules.
- `awesome-tray-evil-show-mode`: If non-nil, show current evil mode in the evil module.
- `awesome-tray-evil-show-macro`: If non-nil, show recording macro in the evil module.
- `awesome-tray-evil-show-cursor-count`: If non-nil, show multiple cursors count in the evil module.
- `awesome-tray-github-update-duration`: Update duration of the github notification, in seconds.
- `awesome-tray-github-erase-duration`: Github notification time before it gets removed from the bar, in seconds.
- `awesome-tray-meow-show-mode`: If non-nil, show current meow mode in the meow module.
- `awesome-tray-input-method-default-style`: Input method indicator you want to show when no input method is toggled on.
- `awesome-tray-input-method-local-style`: Input method indicator for your local input method.
- `awesome-tray-input-method-local-methods`: List of input methods as your local input method. If input method is toggled on, but not a member of this list, `input-method-title` will display in as input method indicator in awesome-tray, such as "DE@" for German. Default is "rime".
## Dangerous options
Please read the docstring for those variables
**Those options can make your awesome-tray look weird, if your minibuffer looks weird disable them**
- `awesome-tray-second-line`: [screenshot](./screenshots/screenshot2.png), Displays awesome-tray in a second line keeping the minibuffer messages readable.
- `awesome-tray-position`: [screenshot](./screenshots/centered.png), Displays awesome-tray in the left, right or center, better to be used with `awesome-tray-second-line` enabled.
## Customize Module
You can control modules through option ```awesome-tray-active-modules```.
**When changing the modules load awesome-tray-mode after setting the modules to prevent useless hooks and changes**
You can find all modules name in the keys of variable ```awesome-tray-module-alist```. Currently we have:
- `awesome-tab`: Show group information of [awesome-tab](https://github.com/manateelazycat/awesome-tab).
- `buffer-name`: Show buffer name.
- `circe`: Show circe tracking buffer information.
- `date`: Show current date.
- `celestial`: If you are not settled for date, you can add lunar phase and sunrise/set time. Requires `celestial-mode-line` package.
- `evil`: Show evil state, recording macro and multiple cursors count in both [evil-mc](https://github.com/gabesoft/evil-mc) and [multiple-cursors](https://github.com/magnars/multiple-cursors.el).
- `file-path`: Show file path with full customizability. When the path is long, it can be shrinked into something like `.../.em/el/awesome-tray/awesome-tray.el`. See `awesome-tray-file-path-***` variables for details.
- `git`: Show git information.
- `last-command`: Show last execute command.
- `location`: Show point position in buffer.
- `pdf-view-page`: Show page number in pdf-view-mode.
- `location-or-page`: Show location or pdf page number depends on current mode.
- `parent-dir`: Show direct parent directory.
- `mode-name`: Show major mode name.
- `rvm`: Show Ruby version information given by `rvm-prompt`.
- `battery`: Show battery status.
- `input-method`: Show input method status.
- `buffer-read-only`: Show read only status.
- `belong`: Show which class/function status, need install `treesit` first.
- `org-pomodoro`: Show `org-pomodoro` status. Denote the rest time of pomodoro by `[.]`, short break by `(.)` and long break by `{.}`.
- `flymake`: Show Flymake state.
- `flycheck`: Show Flycheck state.
- `meow`: Show meow state.
- `mpd`: Show mpd information using [libmpdel](https://github.com/mpdel/libmpdel), you need to connect to a mpd profile, use `(libmpdel-connect-profile (libmpdel--select-profile))` unless you have multiple profiles.
- `volume`: Show current volume using [volume.el](https://github.com/dbrock/volume.el).
- `word-count`: Show file and selected region word-count.
- `anzu`: Show searched word count and current index using [anzu](https://github.com/emacsorphanage/anzu).
- `github`: Show github notifications using [async](https://github.com/jwiegley/emacs-async) and [ghub](https://github.com/magit/ghub).
- `hostname`: Show remote buffers hostname.
## Create a Module
Let's create a module that says hello to you. With a module you need:
- A name. Let's simply call it "hello".
- A info function that returns the string to be displayed. Here's a simple one
``` emacs-lisp
(defun my-module-hello-info ()
(concat "Hello " (user-login-name) "!"))
```
A complex info function may encounter an error, awesome-tray will handle this and not show any information there.
- a face. Let's use a simple yet elegant italic style:
``` emacs-lisp
(defface my-module-hello-face
'((t (:italic t)))
"Hello module face."
:group 'awesome-tray)
```
- Awesome-tray uses `awesome-tray-module-alist` to find informations about a module. Let's put ours in it:
``` emacs-lisp
(add-to-list 'awesome-tray-module-alist
'("hello" . (my-module-hello-info my-module-hello-face)))
```
- Now put `"hello"` in the `awesome-tray-active-modules` list, and you will see awesome-tray say hello to you!
If you created a module that could be useful to others, please consider contributing it to awesome-tray!

View File

@@ -0,0 +1,293 @@
;;; awesome-tray-faces.el --- Faces for Awesome Tray -*-lexical-binding: t; -*-
;;
;; This file is not part of GNU Emacs.
;;
;; 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;
;;; Commentary:
;;
;; This module provides the faces for Awesome Tray.
;;
;;; Code:
;; Base Faces:
(defface awesome-tray-default-face '((t :inherit default :bold t))
"Face for string constant ouside modules."
:group 'awesome-tray)
(defface awesome-tray-grey-face
'((((background light)) :foreground "dim grey" :bold t)
(t :foreground "dark grey" :bold t))
"Awesome tray grey."
:group 'awesome-tray)
(defface awesome-tray-red-face
'((((background light)) :foreground "#cc2444" :bold t)
(t :foreground "#ff2d55" :bold t))
"Awesome tray red."
:group 'awesome-tray)
(defface awesome-tray-green-face
'((((background light)) :foreground "#00a400" :bold t)
(t :foreground "green3" :bold t))
"Awesome tray green."
:group 'awesome-tray)
(defface awesome-tray-green-path-face
'((((background light)) :foreground "#5e8e2e" :bold t)
(t :foreground "#9ded4d" :bold t))
"Awesome green face for paths."
:group 'awesome-tray)
(defface awesome-tray-blue-face
'((((background light)) :foreground "#2832cc" :bold t)
(t :foreground "#333fff" :bold t))
"Awesome tray blue."
:group 'awesome-tray)
(defface awesome-tray-blue-bright-face
'((((background light)) :foreground "#0061cc" :bold t)
(t :foreground "#007aff" :bold t))
"Date face."
:group 'awesome-tray)
(defface awesome-tray-orange-face
'((((background light)) :foreground "#cc7700" :bold t)
(t :foreground "#ff9500" :bold t))
"Awesome tray orange."
:group 'awesome-tray)
(defface awesome-tray-yellow-face
'((((background light)) :foreground "gold" :bold t)
(t :foreground "yellow" :bold t))
"Awesome tray yellow."
:group 'awesome-tray)
(defface awesome-tray-pink-face
'((((background light)) :foreground "deep pink" :bold t)
(t :foreground "hot pink" :bold t))
"Awesome tab pink."
:group 'awesome-tray)
(defface awesome-tray-magenta-face
'((((background light)) :foreground "dark magenta" :bold t)
(t :foreground "magenta" :bold t))
"Awesome tray magenta."
:group 'awesome-tray)
(defface awesome-tray-cyan-face
'((((background light)) :foreground "#008080" :bold t)
(t :foreground "#00ced1" :bold t))
"Awesome tray cyan."
:group 'awesome-tray)
;; Contextual Faces
(defface awesome-tray-module-git-face
'((((background light)) :inherit awesome-tray-red-face)
(t :inherit awesome-tray-red-face))
"Git face."
:group 'awesome-tray)
(defface awesome-tray-module-awesome-tab-face
'((((background light)) :inherit awesome-tray-pink-face)
(t :inherit awesome-tray-pink-face))
"Awesome tab face."
:group 'awesome-tray)
(defface awesome-tray-module-rvm-face
'((((background light)) :inherit awesome-tray-blue-face)
(t :inherit awesome-tray-blue-face))
"RVM face."
:group 'awesome-tray)
(defface awesome-tray-module-circe-face
'((((background light)) :inherit awesome-tray-blue-face)
(t :inherit awesome-tray-blue-face))
"Circe face."
:group 'awesome-tray)
(defface awesome-tray-module-mode-name-face
'((((background light)) :inherit awesome-tray-green-face)
(t :inherit awesome-tray-green-face))
"Mode name face."
:group 'awesome-tray)
(defface awesome-tray-module-location-face
'((((background light)) :inherit awesome-tray-orange-face)
(t :inherit awesome-tray-orange-face))
"Location face."
:group 'awesome-tray)
(defface awesome-tray-module-location-or-page-face
'((((background light)) :inherit awesome-tray-orange-face)
(t :inherit awesome-tray-orange-face))
"Location or page face."
:group 'awesome-tray)
(defface awesome-tray-module-word-count-face
'((((background light)) :inherit awesome-tray-orange-face)
(t :inherit awesome-tray-orange-face))
"Word count face."
:group 'awesome-tray)
(defface awesome-tray-module-anzu-face
'((((background light)) :inherit awesome-tray-orange-face)
(t :inherit awesome-tray-orange-face))
"Anzu face."
:group 'awesome-tray)
(defface awesome-tray-module-github-face
'((((background light)) :inherit awesome-tray-cyan-face)
(t :inherit awesome-tray-cyan-face))
"Github face."
:group 'awesome-tray)
(defface awesome-tray-module-hostname-face
'((((background light)) :inherit awesome-tray-cyan-face)
(t :inherit awesome-tray-cyan-face))
"Hostname face."
:group 'awesome-tray)
(defface awesome-tray-module-volume-face
'((((background light)) :inherit awesome-tray-cyan-face)
(t :inherit awesome-tray-cyan-face))
"Volume face."
:group 'awesome-tray)
(defface awesome-tray-module-mpd-face
'((((background light)) :inherit awesome-tray-cyan-face)
(t :inherit awesome-tray-cyan-face))
"Mpd face."
:group 'awesome-tray)
(defface awesome-tray-module-date-face
'((((background light)) :inherit awesome-tray-grey-face)
(t :inherit awesome-tray-grey-face))
"Date face."
:group 'awesome-tray)
(defface awesome-tray-module-celestial-face
'((((background light)) :inherit awesome-tray-grey-face)
(t :inherit awesome-tray-grey-face))
"Celestial lunar phase and sunrise/set face."
:group 'awesome-tray)
(defface awesome-tray-module-last-command-face
'((((background light)) :inherit awesome-tray-blue-bright-face)
(t :inherit awesome-tray-blue-bright-face))
"Date face."
:group 'awesome-tray)
(defface awesome-tray-module-buffer-name-face
'((((background light)) :inherit awesome-tray-orange-face)
(t :inherit awesome-tray-orange-face))
"Buffer name face."
:group 'awesome-tray)
(defface awesome-tray-module-file-path-face
'((((background light)) :inherit awesome-tray-green-path-face)
(t :inherit awesome-tray-green-path-face))
"Parent dir face."
:group 'awesome-tray)
(defface awesome-tray-module-parent-dir-face
'((((background light)) :inherit awesome-tray-green-path-face)
(t :inherit awesome-tray-green-path-face))
"Parent dir face."
:group 'awesome-tray)
(defface awesome-tray-module-awesome-tab-face
'((((background light)) :inherit awesome-tray-pink-face)
(t :inherit awesome-tray-pink-face))
"Awesome tab face."
:group 'awesome-tray)
(defface awesome-tray-module-evil-face
'((((background light)) :inherit awesome-tray-cyan-face)
(t :inherit awesome-tray-cyan-face))
"Evil state face."
:group 'awesome-tray)
(defface awesome-tray-module-meow-face
'((((background light)) :inherit awesome-tray-cyan-face)
(t :inherit awesome-tray-cyan-face))
"Meow state face."
:group 'awesome-tray)
(defface awesome-tray-module-battery-face
'((((background light)) :inherit awesome-tray-cyan-face)
(t :inherit awesome-tray-cyan-face))
"Battery state face."
:group 'awesome-tray)
(defface awesome-tray-module-buffer-read-only-face
'((((background light)) :inherit awesome-tray-red-face)
(t :inherit awesome-tray-red-face))
"Buffer read only face."
:group 'awesome-tray)
(defface awesome-tray-module-belong-face
'((((background light)) :inherit awesome-tray-red-face)
(t :inherit awesome-tray-red-face))
"Buffer read only face."
:group 'awesome-tray)
(defface awesome-tray-module-input-method-face
'((((background light)) :inherit awesome-tray-cyan-face)
(t :inherit awesome-tray-cyan-face))
"Input method face."
:group 'awesome-tray)
(defface awesome-tray-module-clock-face
'((((background light)) :inherit awesome-tray-blue-bright-face)
(t :inherit awesome-tray-blue-bright-face))
"Org clock face."
:group 'awesome-tray)
(defface awesome-tray-module-org-pomodoro-face
'((((background light)) :inherit awesome-tray-magenta-face)
(t :inherit awesome-tray-magenta-face))
"Org-pomodoro face."
:group 'awesome-tray)
(defface awesome-tray-module-pdf-view-page-face
'((((background light)) :inherit awesome-tray-orange)
(t :inherit awesome-tray-pink-face))
"Pdf-view-page face."
:group 'awesome-tray)
(defface awesome-tray-module-flymake-error
'((t :inherit awesome-tray-red-face))
"Flymake error face."
:group 'awesome-tray)
(defface awesome-tray-module-flymake-warning
'((t :inherit awesome-tray-yellow-face))
"Flymake warning face."
:group 'awesome-tray)
(defface awesome-tray-module-flymake-note
'((t :inherit awesome-tray-blue-bright-face))
"Flymake note face."
:group 'awesome-tray)
(provide 'awesome-tray-faces)
;;; awesome-tray-faces.el ends here

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
# Screenshots
<img src="./screenshot.png">
# With `awesome-tray-second-line` enabled
<img src="./screenshot2.png">
# With `awesome-tray-position` set to center
<img src="./centered.png">

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB