2021-04-29 19:57:30 +00:00
|
|
|
|
#+title: eshell-info-banner.el
|
|
|
|
|
#+author: Lucien Cartier-Tilet
|
|
|
|
|
#+email: lucien@phundrak.com
|
2021-11-14 17:55:43 +00:00
|
|
|
|
[[https://melpa.org/#/eshell-info-banner][file:https://melpa.org/packages/eshell-info-banner-badge.svg]]
|
2021-12-18 15:30:27 +00:00
|
|
|
|
[[https://stable.melpa.org/#/eshell-info-banner][file:https://stable.melpa.org/packages/eshell-info-banner-badge.svg]]
|
2022-05-31 09:31:22 +00:00
|
|
|
|
[[https://github.com/Phundrak/eshell-info-banner.el/actions/workflows/workflow.yml][file:https://github.com/Phundrak/eshell-info-banner.el/actions/workflows/workflow.yml/badge.svg]]
|
2021-11-14 17:55:43 +00:00
|
|
|
|
|
2021-04-29 19:58:20 +00:00
|
|
|
|
* Introduction
|
2021-04-29 19:57:30 +00:00
|
|
|
|
~eshell-info-banner.el~ is a utility for creating an informative banner,
|
|
|
|
|
akin to ~fish_greeting~ but for Eshell. But an image is worth a thousand
|
|
|
|
|
words, let’s see how it looks like:
|
|
|
|
|
|
2021-12-19 16:19:42 +00:00
|
|
|
|
#+caption: Screenshot of the default Eshell information banner (using the nord theme from ~doom-themes~)
|
2021-04-29 19:57:30 +00:00
|
|
|
|
[[file:img/screenshot.png]]
|
|
|
|
|
|
2021-04-29 21:59:56 +00:00
|
|
|
|
This will be displayed every time you open a new Eshell instance, or
|
|
|
|
|
if you invoke ~eshell-info-banner~ from it.
|
|
|
|
|
|
2021-04-29 19:57:30 +00:00
|
|
|
|
This package is geared towards Linux in particular, I am pretty sure
|
|
|
|
|
it will not work on Windows, and there will probably be bugs on
|
|
|
|
|
macOS. PR are welcome if you want to fix that!
|
|
|
|
|
|
2021-05-23 00:15:12 +00:00
|
|
|
|
* Table of Contents :TOC_2_gh:
|
|
|
|
|
- [[#introduction][Introduction]]
|
2021-11-08 12:30:32 +00:00
|
|
|
|
- [[#recent-breaking-changes][Recent Breaking Changes]]
|
2021-12-20 22:08:31 +00:00
|
|
|
|
- [[#081][~0.8.1~]]
|
2021-11-08 12:30:32 +00:00
|
|
|
|
- [[#070][~0.7.0~]]
|
2021-05-23 00:15:12 +00:00
|
|
|
|
- [[#installation][Installation]]
|
|
|
|
|
- [[#customizing][Customizing]]
|
2021-12-19 16:19:42 +00:00
|
|
|
|
- [[#custom-variables][Custom Variables]]
|
|
|
|
|
- [[#faces][Faces]]
|
2021-05-23 00:15:12 +00:00
|
|
|
|
- [[#my-computer-doesnt-have-a-battery-will-this-still-work][My computer doesn’t have a battery, will this still work?]]
|
2021-06-18 17:26:16 +00:00
|
|
|
|
- [[#advice-for-windows-users][Advice for Windows users]]
|
2021-05-23 00:15:12 +00:00
|
|
|
|
- [[#contributing][Contributing]]
|
|
|
|
|
- [[#license][License]]
|
|
|
|
|
|
2021-11-08 12:30:32 +00:00
|
|
|
|
* Recent Breaking Changes
|
2021-12-20 22:08:31 +00:00
|
|
|
|
** ~0.8.1~
|
|
|
|
|
Version ~0.8.1~ removes the optional argument ~REMOTE~ from
|
|
|
|
|
~eshell-info-banner--executable-find~. It now only acts according to the
|
|
|
|
|
user’s preference set with ~eshell-info-banner-tramp-aware~.
|
|
|
|
|
|
2021-11-08 12:30:32 +00:00
|
|
|
|
** ~0.7.0~
|
|
|
|
|
Version ~0.7.0~ renames several functions to conform with the Elisp
|
|
|
|
|
Coding Conventions.
|
2021-12-18 15:30:27 +00:00
|
|
|
|
| Old Name | New Name |
|
|
|
|
|
|----------------------------------------------------+----------------------------------------------------|
|
2021-11-08 12:30:32 +00:00
|
|
|
|
| ~eshell-info-banner--ge-mounted-partitions/duf~ | ~eshell-info-banner--ge-mounted-partitions-duf~ |
|
|
|
|
|
| ~eshell-info-banner--get-mounted-partitions/df~ | ~eshell-info-banner--get-mounted-partitions-df~ |
|
|
|
|
|
| ~eshell-info-banner--get-mounted-partitions/windows~ | ~eshell-info-banner--get-mounted-partitions-windows~ |
|
|
|
|
|
| ~eshell-info-banner--get-mounted-partitions/darwin~ | ~eshell-info-banner--get-mounted-partitions-darwin~ |
|
|
|
|
|
| ~eshell-info-banner--get-mounted-partitions/gnu~ | ~eshell-info-banner--get-mounted-partitions-gnu~ |
|
|
|
|
|
| ~eshell-info-banner--get-memory/gnu~ | ~eshell-info-banner--get-memory-gnu~ |
|
|
|
|
|
| ~eshell-info-banner--get-memory/unix~ | ~eshell-info-banner--get-memory-unix~ |
|
|
|
|
|
| ~eshell-info-banner--get-memory/windows~ | ~eshell-info-banner--get-memory-windows~ |
|
|
|
|
|
| ~eshell-info-banner--get-os-information/windows~ | ~eshell-info-banner--get-os-information-windows~ |
|
|
|
|
|
| ~eshell-info-banner--get-os-information/gnu~ | ~eshell-info-banner--get-os-information-gnu~ |
|
|
|
|
|
| ~eshell-info-banner--get-os-information/darwin~ | ~eshell-info-banner--get-os-information-darwin~ |
|
|
|
|
|
|
|
|
|
|
The following function was removed:
|
|
|
|
|
- ~eshell-info-banner--get-memory/darwin~
|
|
|
|
|
|
|
|
|
|
The following alias (replacing an old function) was removed:
|
|
|
|
|
- ~eshell-info-banner--get-memory/bsd~
|
|
|
|
|
|
2021-05-15 18:32:49 +00:00
|
|
|
|
* Installation
|
2021-04-29 19:57:30 +00:00
|
|
|
|
A couple of options are available for installing
|
|
|
|
|
~eshell-info-banner.el~. The first one is to clone the repository in
|
|
|
|
|
your ~load-path~ and add the following to your ~.emacs~ or your ~init.el~:
|
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
|
(require 'eshell-info-banner)
|
|
|
|
|
(add-hook 'eshell-banner-load-hook 'eshell-info-banner-update-banner)
|
|
|
|
|
#+end_src
|
|
|
|
|
|
2021-11-14 17:55:43 +00:00
|
|
|
|
If you use ~use-package~ only and install the package from MELPA, you
|
|
|
|
|
can then install it like so:
|
2021-07-13 15:57:09 +00:00
|
|
|
|
#+begin_src emacs-lisp
|
|
|
|
|
(use-package eshell-info-banner
|
|
|
|
|
:ensure t
|
|
|
|
|
:defer t
|
|
|
|
|
:hook (eshell-banner-load . eshell-info-banner-update-banner))
|
|
|
|
|
#+end_src
|
|
|
|
|
|
2021-04-29 19:57:30 +00:00
|
|
|
|
In my case, I prefer using ~use-package~ with ~straight~:
|
|
|
|
|
#+begin_src emacs-lisp
|
2021-07-13 15:57:09 +00:00
|
|
|
|
(use-package eshell-info-banner
|
|
|
|
|
:ensure t
|
|
|
|
|
:defer t
|
2021-11-14 17:55:43 +00:00
|
|
|
|
:straight (:build t)
|
2021-07-13 15:57:09 +00:00
|
|
|
|
:hook (eshell-banner-load . eshell-info-banner-update-banner))
|
2021-04-29 19:57:30 +00:00
|
|
|
|
#+end_src
|
|
|
|
|
|
2021-11-14 17:55:43 +00:00
|
|
|
|
You can just use ~:straight t~ if you do not want to ensure the package
|
|
|
|
|
gets compiled by Emacs.
|
2021-04-29 19:57:30 +00:00
|
|
|
|
|
|
|
|
|
There is probably a similar way to install it with pure ~straight.el~ or
|
|
|
|
|
~quelpa~, but I’m not knowledgable enough for that, feel free to create
|
|
|
|
|
a PR to add some more installation instructions!
|
|
|
|
|
|
2021-04-29 19:58:20 +00:00
|
|
|
|
* Customizing
|
2021-12-19 16:19:42 +00:00
|
|
|
|
** Custom Variables
|
2021-04-29 19:57:30 +00:00
|
|
|
|
A couple of variables can be edited by the user in order to configure
|
|
|
|
|
~eshell-info-banner.el~:
|
2021-05-15 18:32:49 +00:00
|
|
|
|
- ~eshell-info-banner-partition-prefixes~ :: Filter for which
|
|
|
|
|
mountpoints are to be shown to the user. By default, only partitions
|
|
|
|
|
mounted on a filesystem (as displayed by the command ~df -Hl~)
|
|
|
|
|
prefixed by ~/dev~ are shown, but you can modify it by adding other
|
|
|
|
|
prefixes to this list. For instance, to detect ZFS roots, you can
|
2021-05-15 18:40:10 +00:00
|
|
|
|
set its value to ~("/dev" "zroot")~.
|
2021-05-15 18:32:49 +00:00
|
|
|
|
|
2021-05-15 18:40:10 +00:00
|
|
|
|
Default value: ~("/dev")~
|
2021-04-29 19:57:30 +00:00
|
|
|
|
- ~eshell-info-banner-shorten-path-from~ :: Maximum length of the mount
|
|
|
|
|
path of a partition before it gets abbreviated. Set it to ridiculous
|
|
|
|
|
numbers in order to disable it (something like ~1000~ should be more
|
2021-05-15 18:32:49 +00:00
|
|
|
|
than enough).
|
|
|
|
|
|
|
|
|
|
Default value: ~7~
|
2021-04-29 19:57:30 +00:00
|
|
|
|
- ~eshell-info-banner-width~ :: *Minimum* width of the banner. Be aware
|
|
|
|
|
the banner will automatically select the minimal width required to
|
|
|
|
|
display everything it wants to display if ~eshell-info-banner-width~
|
2021-05-15 18:32:49 +00:00
|
|
|
|
is too small.
|
|
|
|
|
Default value: ~80~
|
2021-04-29 19:57:30 +00:00
|
|
|
|
- ~eshell-info-banner-progress-bar-char~ :: Character to fill the
|
2021-05-15 18:32:49 +00:00
|
|
|
|
progress bar with.
|
|
|
|
|
|
|
|
|
|
Default value: ~=~
|
2021-04-29 19:57:30 +00:00
|
|
|
|
- ~eshell-info-banner-warning-percentage~ :: Percentage from which the
|
2021-05-15 18:32:49 +00:00
|
|
|
|
level should be displayed as a warning.
|
|
|
|
|
|
|
|
|
|
Default value: ~75~
|
2021-04-29 19:57:30 +00:00
|
|
|
|
- ~eshell-info-banner-critical-percentage~ :: Percentage from which the
|
2021-05-15 18:32:49 +00:00
|
|
|
|
level should be displayed as critical.
|
|
|
|
|
|
2021-06-18 16:26:24 +00:00
|
|
|
|
Default value: ~90~
|
2021-05-14 08:33:07 +00:00
|
|
|
|
- ~eshell-info-banner-tramp-aware~ :: When using Eshell through TRAMP,
|
|
|
|
|
you can decide whether ~eshell-info-banner~ will display information
|
|
|
|
|
about the remote system you are connected to or only display
|
|
|
|
|
information about your local system. To achieve this, set
|
|
|
|
|
~eshell-info-banner-tramp-aware~ to ~t~ to display information on the
|
2021-05-15 18:32:49 +00:00
|
|
|
|
remote system or to ~nil~ to keep local information only.
|
|
|
|
|
|
2021-06-18 16:26:24 +00:00
|
|
|
|
Default value: ~t~
|
|
|
|
|
- ~eshell-info-banner-use-duf~ :: Whether or not to use [[https://github.com/muesli/duf][duf]]. ~duf~ is a
|
|
|
|
|
better replacement for ~df~ and should be more platform-agnostic than
|
|
|
|
|
the latter. I also suspect this implementation will be faster than
|
|
|
|
|
the one with ~df~, since there is very few string manipulation with
|
2021-06-18 17:26:16 +00:00
|
|
|
|
~duf~ compared to the implementations with ~df~.
|
2021-06-18 16:26:24 +00:00
|
|
|
|
|
|
|
|
|
Default value: ~t~ if ~duf~ is found on the system, ~nil~ otherwise
|
|
|
|
|
- ~eshell-info-banner-duf-executable~ :: Path to your ~duf~ executable. If
|
|
|
|
|
~duf~ is not found by default by Emacs, you can override
|
|
|
|
|
~eshell-info-banner-use-duf~ with ~t~ and specify the path to ~duf~ with
|
|
|
|
|
this custom variable.
|
|
|
|
|
|
|
|
|
|
Default value: ~duf~
|
2021-12-19 16:19:42 +00:00
|
|
|
|
- ~eshell-info-banner-file-size-flavor~ :: This variable reflects the
|
|
|
|
|
possible values passed to the function ~file-size-human-readable~. It
|
|
|
|
|
can hold one of these three values:
|
|
|
|
|
- ~nil~
|
|
|
|
|
- ~si~
|
|
|
|
|
- ~iec~
|
|
|
|
|
Since the value ~iec~ generates longer file size prefixes, progress
|
|
|
|
|
bars become slightly shorter. For more details on this option, see
|
|
|
|
|
the documentation of ~file-size-human-readable~.
|
|
|
|
|
|
|
|
|
|
Default value: ~nil~
|
|
|
|
|
|
|
|
|
|
** Faces
|
2021-04-29 21:05:31 +00:00
|
|
|
|
Don’t like the colors used by the package? They should follow by
|
|
|
|
|
default your theme, but you can customize the following faces:
|
|
|
|
|
- ~eshell-info-banner-background-face~ :: Used for filling the empty
|
|
|
|
|
part of progress bars
|
|
|
|
|
- ~eshell-info-banner-normal-face~ :: Used for filling the progress bar
|
|
|
|
|
when on normal levels
|
|
|
|
|
- ~eshell-info-banner-warning-face~ :: Used for filling the progress bar
|
|
|
|
|
when on warning levels
|
|
|
|
|
- ~eshell-info-banner-critical-face~ :: Used for filling the progress
|
|
|
|
|
bar when on critical levels
|
|
|
|
|
|
2021-04-29 21:59:56 +00:00
|
|
|
|
* My computer doesn’t have a battery, will this still work?
|
|
|
|
|
As you can see, one line shows you your battery level. Il will start
|
|
|
|
|
to warn you in a reverse way compared to the other progress bars, as
|
|
|
|
|
it should for battery levels –a fully charged battery at 100% is not
|
|
|
|
|
at a critical level, but at 0% it would be.
|
|
|
|
|
|
|
|
|
|
However, you might be on a desktop or any kind of computer that does
|
|
|
|
|
not have a battery, so… what do? Don’t worry, /Emacs will automatically
|
|
|
|
|
detect whether you have a battery or not/ and will only display this
|
|
|
|
|
line if you have one. If you don’t have a battery, the only difference
|
|
|
|
|
is you will have one less line than laptop users.
|
|
|
|
|
|
2021-06-18 17:26:16 +00:00
|
|
|
|
* Advice for Windows users
|
2022-04-02 17:31:30 +00:00
|
|
|
|
Currently, ~eshell-info-banner~ can only look for your partitions with
|
|
|
|
|
~duf~. If you want a list of your partitions, I strongly encourage you
|
|
|
|
|
to install it on your system. See [[https://github.com/muesli/duf#windows][muesli/duf]].
|
2021-06-18 17:26:16 +00:00
|
|
|
|
|
2021-05-23 00:15:12 +00:00
|
|
|
|
* Contributing
|
|
|
|
|
See [[file:CONTRIBUTING.org]].
|
2021-04-30 14:59:42 +00:00
|
|
|
|
|
2021-04-29 19:58:20 +00:00
|
|
|
|
* License
|
2021-04-29 19:57:30 +00:00
|
|
|
|
~eshell-info-banner.el~ is available under the GNU GPL-3.0 license. You
|
2021-11-15 09:11:16 +00:00
|
|
|
|
can find the full text in the [[file:LICENSE][LICENSE]] file.
|