[StumpWM, bin] Add docker indicator, nerd font to font list

This commit is contained in:
Lucien Cartier-Tilet 2023-03-10 15:16:15 +01:00
parent 02137f0c4a
commit 5f41c8e71d
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 41 additions and 23 deletions

View File

@ -288,6 +288,20 @@ sudo chmod a+rw /opt/flutter/version
sudo chown $USER:(id -g $USER) /opt/flutter/bin/cache sudo chown $USER:(id -g $USER) /opt/flutter/bin/cache
#+END_SRC #+END_SRC
** docker-running
:PROPERTIES:
:CUSTOM_ID: cliutilitiesdockerrunning-awb2jbx09rj0
:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :tangle ~/.local/bin/docker-running
:END:
As with =mu-unread= below, =docker-running= is a small and simple utility
for my StumpWM configuration which indicates how many Docker
containers are currently running.
#+begin_src sh
NB_CONTAINERS=$(docker ps -q | wc -l | tr -d '\n')
printf "^f3^f0 %d" $NB_CONTAINERS
#+end_src
** mu-unread ** mu-unread
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :tangle ~/.local/bin/mu-unread :HEADER-ARGS: :shebang "#!/usr/bin/env sh" :tangle ~/.local/bin/mu-unread

View File

@ -497,17 +497,18 @@ We can indicate what to display in our modeline. Each formatter will
be separated by a Powerline separator with the code point ~0xE0B0~ in be separated by a Powerline separator with the code point ~0xE0B0~ in
the font I am using (see §[[#Theme-Fonts-28pc8141v5j0]]). the font I am using (see §[[#Theme-Fonts-28pc8141v5j0]]).
#+name: modeline-format #+name: modeline-format
| Formatter | What it does | Command? | | Formatter | What it does | Command? |
|-----------+-------------------------------------------------------+----------| |------------------+-------------------------------------------------------+----------|
| ~%g~ | Display list of groups | | | ~%g~ | Display list of groups | |
| ~%W~ | Display list of windows in the current group and head | | | ~%W~ | Display list of windows in the current group and head | |
| ~^>~ | Rest of the modeline align to the right | | | ~^>~ | Rest of the modeline align to the right | |
| ~mu-unread~ | Display number of unread emails | yes | | ~docker-running~ | Display number of docker containers currently running | yes |
| ~%m~ | Display current MPD song | | | ~mu-unread~ | Display number of unread emails | yes |
| ~%C~ | Display CPU usage | | | ~%m~ | Display current MPD song | |
| ~%M~ | Display RAM usage | | | ~%C~ | Display CPU usage | |
| ~%B~ | Display battery status | | | ~%M~ | Display RAM usage | |
| ~%d~ | Display date | | | ~%B~ | Display battery status | |
| ~%d~ | Display date | |
#+name: modeline-format-gen #+name: modeline-format-gen
#+begin_src emacs-lisp :var elements=modeline-format :exports none #+begin_src emacs-lisp :var elements=modeline-format :exports none
@ -520,8 +521,8 @@ the font I am using (see §[[#Theme-Fonts-28pc8141v5j0]]).
elements) elements)
#+end_src #+end_src
#+RESULTS[89f2af6e60ba033da3f22eb62c229293103fe266]: modeline-format-gen #+RESULTS[4246baab1293d54bcd2223590f274152f24934c3]: modeline-format-gen
: (("%g") ("%W") ("^>") ("mu-unread" . t) ("%m") ("%C") ("%M") ("%B") ("%d")) : (("%g") ("%W") ("^>") ("docker-running" . t) ("mu-unread" . t) ("%m") ("%C") ("%M") ("%B") ("%d"))
#+begin_src lisp :noweb yes #+begin_src lisp :noweb yes
(defvar *mode-line-formatter-list* (defvar *mode-line-formatter-list*
@ -705,9 +706,10 @@ We can now go onto more serious business.
:CUSTOM_ID: Theme-Fonts-28pc8141v5j0 :CUSTOM_ID: Theme-Fonts-28pc8141v5j0
:END: :END:
This gave me quite the headache when I tried to set this up: in order This gave me quite the headache when I tried to set this up: in order
to use TTF or OTF fonts, we need to use the ~ttf-fonts~ module which to use TTF fonts (note: it is not possible to use OTF fonts, see
relies on the ~clx-truetype~ library. A few years back, it should have below), we need to use the ~ttf-fonts~ module which relies on the
been possible to get it installed with a call to src_lisp[:exports ~clx-truetype~ library. A few years back, it should have been possible
to get it installed with a call to src_lisp[:exports
code]{(ql:quickload :clx-truetype)}, but it is no longer available! code]{(ql:quickload :clx-truetype)}, but it is no longer available!
Theres a quickfix available while we wait for ~clx-truetype~ to be once Theres a quickfix available while we wait for ~clx-truetype~ to be once
again available: clone it in quicklisps local projects. You will again available: clone it in quicklisps local projects. You will
@ -776,11 +778,12 @@ cannot render a character, it will simply display an empty rectangle
instead of falling back to another font. Thats annoying… Here is my instead of falling back to another font. Thats annoying… Here is my
list of fonts I want loaded: list of fonts I want loaded:
#+name: list-fonts #+name: list-fonts
| Family | Subfamily | Size | | Family | Subfamily | Size |
|--------------------------------+-----------+------| |----------------------------------+-----------+------|
| Unifont-JP | Regular | 10 | | Unifont-JP | Regular | 10 |
| DejaVu Sans Mono for Powerline | Book | 8.5 | | DejaVu Sans Mono for Powerline | Book | 8.5 |
| siji | Medium | 10 | | siji | Medium | 10 |
| FantasqueSansMono Nerd Font Mono | Regular | 9.5 |
#+name: gen-fonts #+name: gen-fonts
#+header: :wrap src lisp #+header: :wrap src lisp
@ -800,11 +803,12 @@ list of fonts I want loaded:
#+end_src #+end_src
The code equivalent of this table can be seen below: The code equivalent of this table can be seen below:
#+RESULTS[8f33434f3332d94fa0d7306c1233c824a26fde93]: gen-fonts #+RESULTS[1693001a9a9c0e274a9b7097665e9795783ae8a2]: gen-fonts
#+begin_src lisp #+begin_src lisp
(set-font `(,(make-instance 'xft:font :family "Unifont-JP" :subfamily "Regular" :size 10 :antialias t) (set-font `(,(make-instance 'xft:font :family "Unifont-JP" :subfamily "Regular" :size 10 :antialias t)
,(make-instance 'xft:font :family "DejaVu Sans Mono for Powerline" :subfamily "Book" :size 8.5 :antialias t) ,(make-instance 'xft:font :family "DejaVu Sans Mono for Powerline" :subfamily "Book" :size 8.5 :antialias t)
,(make-instance 'xft:font :family "siji" :subfamily "Medium" :size 10 :antialias t))) ,(make-instance 'xft:font :family "siji" :subfamily "Medium" :size 10 :antialias t)
,(make-instance 'xft:font :family "FantasqueSansMono Nerd Font Mono" :subfamily "Regular" :size 9.5 :antialias t)))
#+end_src #+end_src
As far as I know, Unifont is the only font Ive tested that displays As far as I know, Unifont is the only font Ive tested that displays