Compare commits

...

7 Commits

3 changed files with 100 additions and 54 deletions

View File

@ -1034,7 +1034,7 @@ rm $TMPBG
* Polybar-launch (Deprecated) :noexport:
: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
:END:
This scripts allows the user to kill polybar and relaunch it, or to simply

View File

@ -21,7 +21,8 @@ in progress document, lots of comments on existing configuration are
missing, and lots of functionalities are still not implemented. Im
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]]
* Basic configuration
@ -3471,6 +3472,41 @@ files.
(setq preview-org-html-refresh-configuration 'save))
#+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, its not great compared to its markdown support. So, instead,
lets 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
:PROPERTIES:
: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))
#+end_src
**** Markdown
:PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Org-mode-File-export-Markdown-g2vh5vz095j0
:END:
Theres 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,
theres 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
:PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Org-mode-File-export-Reveal-js-mzijhel099j0

View File

@ -359,11 +359,42 @@ need to reload them now that we modified them.
And with that were done!
* Modeline
* Mode-Line
:PROPERTIES:
:CUSTOM_ID: Modeline-g2ofyw01v5j0
:header-args:lisp: :mkdirp yes :tangle ~/.stumpwm.d/modeline.lisp
: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
Lets 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, lets load the ~colors.lisp~ file we just created:
#+begin_src lisp
(load "~/.stumpwm.d/colors.lisp")
@ -384,38 +415,19 @@ still set its color to Nord1, just in case.
,*mode-line-border-width* 0)
#+end_src
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
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
Lets 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 Modules
:PROPERTIES:
:CUSTOM_ID: Mode-Line-Mode-Line-Modules-tlihmy814aj0
:END:
Here are some modules that we will load for the modeline:
#+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 |
| cpu | Get the CPU usage |
| mpd | Display MPDs status |
| mem | Get the memory usage |
| net | |
| net | Display network usage |
| wifi | Display information about Wifi connectivity |
#+name: gen-load-modeline-modules
@ -437,8 +449,7 @@ Here are some modules that we will load for the modeline:
(load-module "wifi")
#+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
formatter is U+E082, which symbolizes the CPU.
#+begin_src lisp
@ -453,6 +464,10 @@ formatter is U+E082, which symbolizes the CPU.
,*mode-line-highlight-template* "«~A»")
#+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
be separated by a Powerline separator with the code point ~0xE0B0~ in
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"))
#+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)
"Generate a modeline for StumpWM.
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))
(format nil "~A" formatter))
(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 () ()
"Reload modeline."
(setf *screen-mode-line-format*
(cdr (generate-modeline '<<modeline-format-gen()>>))))
(cdr (generate-modeline *mode-line-formatter-list*))))
#+end_src
And actually, lets reload the modeline immediately.
#+begin_src lisp
(reload-modeline)
#+end_src
This variable as you can see is a list of elements, although here I am
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~ doesnt work :noexport:
** TODO Investigate why ~stumptray~ acts up :noexport:
:PROPERTIES:
:CUSTOM_ID: Modeline-Investigate-why-stumptray-doesn-t-work-0juh13g0m6j0
:END:
Systray overlaps with the far-right part of the modeline.
# Also, lets enable a system tray.
# #+begin_src lisp