Compare commits
7 Commits
a04de69b10
...
d2cbdc3289
Author | SHA1 | Date |
---|---|---|
Lucien Cartier-Tilet | d2cbdc3289 | |
Lucien Cartier-Tilet | a1138a9ff9 | |
Lucien Cartier-Tilet | aa290484dd | |
Lucien Cartier-Tilet | d42fc15e64 | |
Lucien Cartier-Tilet | 27fdcac542 | |
Lucien Cartier-Tilet | fa9767ec19 | |
Lucien Cartier-Tilet | a028c0284a |
|
@ -1034,7 +1034,7 @@ rm $TMPBG
|
||||||
|
|
||||||
* Polybar-launch (Deprecated) :noexport:
|
* Polybar-launch (Deprecated) :noexport:
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/polybar-launch
|
:HEADER-ARGS: :shebang "#!/usr/bin/env bash" :mkdirp yes :tangle ~/.local/bin/polybar-launch
|
||||||
:CUSTOM_ID: Polybar-launch-36789edc
|
:CUSTOM_ID: Polybar-launch-36789edc
|
||||||
:END:
|
:END:
|
||||||
This scripts allows the user to kill polybar and relaunch it, or to simply
|
This scripts allows the user to kill polybar and relaunch it, or to simply
|
||||||
|
|
|
@ -21,7 +21,8 @@ in progress document, lots of comments on existing configuration are
|
||||||
missing, and lots of functionalities are still not implemented. I’m
|
missing, and lots of functionalities are still not implemented. I’m
|
||||||
still in the process of porting my [[file:spacemacs.org][Spacemacs]] configuration over here.
|
still in the process of porting my [[file:spacemacs.org][Spacemacs]] configuration over here.
|
||||||
|
|
||||||
#+attr_html: :alt Dammit Emacs…
|
#+attr_html: :alt Dammit Emacs… :loading lazy
|
||||||
|
#+caption: XKCD n°378
|
||||||
[[file:./img/real_programmers.png]]
|
[[file:./img/real_programmers.png]]
|
||||||
|
|
||||||
* Basic configuration
|
* Basic configuration
|
||||||
|
@ -3471,6 +3472,41 @@ files.
|
||||||
(setq preview-org-html-refresh-configuration 'save))
|
(setq preview-org-html-refresh-configuration 'save))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
**** Hugo
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: Packages-Configuration-Org-mode-Exporters-Hugo-ca3473613aj0
|
||||||
|
:END:
|
||||||
|
I manage [[https://blog.phundrak.com][my blog]] with [[https://gohugo.io/][Hugo]]. Although it natively supports the org
|
||||||
|
format, it’s not great compared to its markdown support. So, instead,
|
||||||
|
let’s directly export our org files as markdown files and let Hugo do
|
||||||
|
the rest of the job for us!
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package ox-hugo
|
||||||
|
:defer t
|
||||||
|
:after ox
|
||||||
|
:straight t)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
I also have a function for publishing my blog once I exported my
|
||||||
|
articles with ~ox-hugo~. It will compile blog into a ~public/~ directory
|
||||||
|
and copy its content over to my remote server.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defun phundrak/blog-publish ()
|
||||||
|
"Publish my blog through Hugo to my remote server."
|
||||||
|
(interactive)
|
||||||
|
(let* ((default-directory (expand-file-name "~/org/blog"))
|
||||||
|
(public-path (concat default-directory "/public"))
|
||||||
|
(target-path "/rsync:Tilo:/home/phundrak/www/phundrak.com/blog"))
|
||||||
|
(compile "hugo")
|
||||||
|
(let ((files (mapcar (lambda (file)
|
||||||
|
(f-relative file public-path))
|
||||||
|
(f-files public-path nil t))))
|
||||||
|
(dolist (file files)
|
||||||
|
(copy-file (concat public-path "/" file)
|
||||||
|
(concat target-path "/" file)
|
||||||
|
t nil t)))))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
**** LaTeX
|
**** LaTeX
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: Packages-Configuration-Org-mode-File-export-LaTeXg2b5fl6184j0
|
:CUSTOM_ID: Packages-Configuration-Org-mode-File-export-LaTeXg2b5fl6184j0
|
||||||
|
@ -3554,22 +3590,6 @@ add their extension like so:
|
||||||
(add-to-list 'org-latex-logfiles-extensions ext t))
|
(add-to-list 'org-latex-logfiles-extensions ext t))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
**** Markdown
|
|
||||||
:PROPERTIES:
|
|
||||||
:CUSTOM_ID: Packages-Configuration-Org-mode-File-export-Markdown-g2vh5vz095j0
|
|
||||||
:END:
|
|
||||||
There’s not really any unified Markdown specification, meaning
|
|
||||||
everyone can pretty much do whatever they want with the syntax and
|
|
||||||
still call it Markdown. Great… But something I appreciate is Github
|
|
||||||
supports some extra HTML to make our files extra spicy! And lucky me,
|
|
||||||
there’s a package for exporting my org files to Github-flavored
|
|
||||||
Markdown!
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package ox-gfm
|
|
||||||
:after (ox org)
|
|
||||||
:straight (:build t))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
**** Reveal.js
|
**** Reveal.js
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: Packages-Configuration-Org-mode-File-export-Reveal-js-mzijhel099j0
|
:CUSTOM_ID: Packages-Configuration-Org-mode-File-export-Reveal-js-mzijhel099j0
|
||||||
|
|
|
@ -359,11 +359,42 @@ need to reload them now that we modified them.
|
||||||
|
|
||||||
And with that we’re done!
|
And with that we’re done!
|
||||||
|
|
||||||
* Modeline
|
* Mode-Line
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: Modeline-g2ofyw01v5j0
|
:CUSTOM_ID: Modeline-g2ofyw01v5j0
|
||||||
:header-args:lisp: :mkdirp yes :tangle ~/.stumpwm.d/modeline.lisp
|
:header-args:lisp: :mkdirp yes :tangle ~/.stumpwm.d/modeline.lisp
|
||||||
:END:
|
:END:
|
||||||
|
The timeout of the modeline indicates how often it refreshes in
|
||||||
|
seconds. I think two seconds is good.
|
||||||
|
#+begin_src lisp
|
||||||
|
(setf *mode-line-timeout* 2)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Formatting Options
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: Mode-Line-Formatting-Options-3n494y814aj0
|
||||||
|
:END:
|
||||||
|
Next we get to the content of the modeline. This format follows the
|
||||||
|
format indicated in the manpage of ~date~.
|
||||||
|
#+begin_src lisp
|
||||||
|
(setf *time-modeline-string* "%F %H:%M")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
Let’s also indicate how the groupname is displayed.
|
||||||
|
#+begin_src lisp
|
||||||
|
(setf *group-format* "%t")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
The window format should display first its window number, then its
|
||||||
|
titled, limited to 30 characters.
|
||||||
|
#+begin_src lisp
|
||||||
|
(setf *window-format* "%n: %30t")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Mode-Line Theme
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: Mode-Line-Mode-Line-Theme-4mm37x814aj0
|
||||||
|
:END:
|
||||||
The modeline is pretty easy. First, let’s load the ~colors.lisp~ file we just created:
|
The modeline is pretty easy. First, let’s load the ~colors.lisp~ file we just created:
|
||||||
#+begin_src lisp
|
#+begin_src lisp
|
||||||
(load "~/.stumpwm.d/colors.lisp")
|
(load "~/.stumpwm.d/colors.lisp")
|
||||||
|
@ -384,38 +415,19 @@ still set its color to Nord1, just in case.
|
||||||
,*mode-line-border-width* 0)
|
,*mode-line-border-width* 0)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
The timeout of the modeline indicates how often it refreshes in
|
** Mode-Line Modules
|
||||||
seconds. I think two seconds is good.
|
:PROPERTIES:
|
||||||
#+begin_src lisp
|
:CUSTOM_ID: Mode-Line-Mode-Line-Modules-tlihmy814aj0
|
||||||
(setf *mode-line-timeout* 2)
|
:END:
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Next we get to the content of the modeline. This format follows the
|
|
||||||
format indicated in the manpage of ~date~.
|
|
||||||
#+begin_src lisp
|
|
||||||
(setf *time-modeline-string* "%F %H:%M")
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Let’s also indicate how the groupname is displayed.
|
|
||||||
#+begin_src lisp
|
|
||||||
(setf *group-format* "%t")
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
The window format should display first its window number, then its
|
|
||||||
titled, limited to 30 characters.
|
|
||||||
#+begin_src lisp
|
|
||||||
(setf *window-format* "%n: %30t")
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Here are some modules that we will load for the modeline:
|
Here are some modules that we will load for the modeline:
|
||||||
#+name: modeline-modules
|
#+name: modeline-modules
|
||||||
| Module Name | Why It Is Loaded |
|
| Module Name | Why Do I Need It? |
|
||||||
|------------------+--------------------------------------------------|
|
|------------------+--------------------------------------------------|
|
||||||
| battery-portable | Get information on the battery level of a laptop |
|
| battery-portable | Get information on the battery level of a laptop |
|
||||||
| cpu | Get the CPU usage |
|
| cpu | Get the CPU usage |
|
||||||
| mpd | Display MPD’s status |
|
| mpd | Display MPD’s status |
|
||||||
| mem | Get the memory usage |
|
| mem | Get the memory usage |
|
||||||
| net | |
|
| net | Display network usage |
|
||||||
| wifi | Display information about Wifi connectivity |
|
| wifi | Display information about Wifi connectivity |
|
||||||
|
|
||||||
#+name: gen-load-modeline-modules
|
#+name: gen-load-modeline-modules
|
||||||
|
@ -437,8 +449,7 @@ Here are some modules that we will load for the modeline:
|
||||||
(load-module "wifi")
|
(load-module "wifi")
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Some variables need to be set so modules are displayed correctly.
|
We need to set some variables so modules can be displayed correctly.
|
||||||
|
|
||||||
Note that the character between the font switchers in the second CPU
|
Note that the character between the font switchers in the second CPU
|
||||||
formatter is U+E082, which symbolizes the CPU.
|
formatter is U+E082, which symbolizes the CPU.
|
||||||
#+begin_src lisp
|
#+begin_src lisp
|
||||||
|
@ -453,6 +464,10 @@ formatter is U+E082, which symbolizes the CPU.
|
||||||
,*mode-line-highlight-template* "«~A»")
|
,*mode-line-highlight-template* "«~A»")
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** Generating the Mode-Line
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: Modeline-Generating-the-Mode-Line-daw8qp814aj0
|
||||||
|
:END:
|
||||||
We can indicate what to display in our modeline. Each formatter will
|
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]]).
|
||||||
|
@ -486,6 +501,15 @@ the font I am using (see §[[#Theme-Fonts-28pc8141v5j0]]).
|
||||||
: (("%g") ("%W") ("^>") ("mu-unread" . t) ("%m") ("%I") ("%l") ("%C") ("%M") ("%B") ("%d"))
|
: (("%g") ("%W") ("^>") ("mu-unread" . t) ("%m") ("%I") ("%l") ("%C") ("%M") ("%B") ("%d"))
|
||||||
|
|
||||||
#+begin_src lisp :noweb yes
|
#+begin_src lisp :noweb yes
|
||||||
|
(defvar *mode-line-formatter-list*
|
||||||
|
'<<modeline-format-gen()>>
|
||||||
|
"List of formatters for the modeline.")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
As you can see, ~generate-modeline~ generates the string defining
|
||||||
|
~*screen-mode-line-format*~ from the list of formatters we gave it with
|
||||||
|
the table [[modeline-format]].
|
||||||
|
#+begin_src lisp
|
||||||
(defun generate-modeline (elements &optional not-invertedp)
|
(defun generate-modeline (elements &optional not-invertedp)
|
||||||
"Generate a modeline for StumpWM.
|
"Generate a modeline for StumpWM.
|
||||||
ELEMENTS should be a list of `cons'es which `car' is the modeline
|
ELEMENTS should be a list of `cons'es which `car' is the modeline
|
||||||
|
@ -509,25 +533,27 @@ when the `car' is a formatter and t when it is a shell command."
|
||||||
`(:eval (run-shell-command ,formatter t))
|
`(:eval (run-shell-command ,formatter t))
|
||||||
(format nil "~A" formatter))
|
(format nil "~A" formatter))
|
||||||
(generate-modeline (cdr elements) (not not-invertedp)))))))
|
(generate-modeline (cdr elements) (not not-invertedp)))))))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
It is then easy to define a command that can call this function and
|
||||||
|
set this variable so we can sort of reload the mode-line.
|
||||||
|
#+begin_src lisp
|
||||||
(defcommand reload-modeline () ()
|
(defcommand reload-modeline () ()
|
||||||
"Reload modeline."
|
"Reload modeline."
|
||||||
(setf *screen-mode-line-format*
|
(setf *screen-mode-line-format*
|
||||||
(cdr (generate-modeline '<<modeline-format-gen()>>))))
|
(cdr (generate-modeline *mode-line-formatter-list*))))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
And actually, let’s reload the modeline immediately.
|
||||||
|
#+begin_src lisp
|
||||||
(reload-modeline)
|
(reload-modeline)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
This variable as you can see is a list of elements, although here I am
|
** TODO Investigate why ~stumptray~ acts up :noexport:
|
||||||
only using one string. But it is absolutely possible to insert some
|
|
||||||
CLisp code in here that returns some string if the user needs some
|
|
||||||
code to return data that cannot be easily accesible otherwise. I might
|
|
||||||
add some at some point, but not today yet.
|
|
||||||
|
|
||||||
** TODO Investigate why ~stumptray~ doesn’t work :noexport:
|
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: Modeline-Investigate-why-stumptray-doesn-t-work-0juh13g0m6j0
|
:CUSTOM_ID: Modeline-Investigate-why-stumptray-doesn-t-work-0juh13g0m6j0
|
||||||
:END:
|
:END:
|
||||||
|
Systray overlaps with the far-right part of the modeline.
|
||||||
|
|
||||||
# Also, let’s enable a system tray.
|
# Also, let’s enable a system tray.
|
||||||
# #+begin_src lisp
|
# #+begin_src lisp
|
||||||
|
|
Loading…
Reference in New Issue