Add mowedline config
This commit is contained in:
parent
10dc203ace
commit
83dff80d0b
4 changed files with 104 additions and 0 deletions
13
mowedline/.config/herbstluftwm/autostart.d/mowedline-tags.sh
Normal file
13
mowedline/.config/herbstluftwm/autostart.d/mowedline-tags.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
if ! whence hc; then
|
||||
function hc() { herbstclient "$@"; }
|
||||
fi
|
||||
|
||||
# Keep my taglist widget up-to-date in mowedline. Quit if the "reload"
|
||||
# hook is emitted because it will be restarted by this configuration.
|
||||
while :; do
|
||||
mowedline-client update taglist "$(hc tag_status)" 2>/dev/null
|
||||
read -r event _ < <(hc --wait 'tag_changed|reload')
|
||||
[[ "$event" == "reload" ]] && break
|
||||
done &
|
84
mowedline/.config/mowedline/init.org
Normal file
84
mowedline/.config/mowedline/init.org
Normal file
|
@ -0,0 +1,84 @@
|
|||
Load the =matchable= module so I can use =match-lambda=.
|
||||
|
||||
#+BEGIN_SRC scheme
|
||||
(use matchable)
|
||||
#+END_SRC
|
||||
|
||||
Set the default font and color to something nicer.
|
||||
|
||||
#+BEGIN_SRC scheme
|
||||
(text-widget-font "Fantasque Sans Mono-13:bold")
|
||||
(text-widget-color "#ededed")
|
||||
#+END_SRC
|
||||
|
||||
This formatter will parse the herbstluftwm tag status line, which
|
||||
looks like this:
|
||||
|
||||
#+BEGIN_EXAMPLE
|
||||
#1 -2 :3 :4 :5 .6 .7 .8 .9
|
||||
#+END_EXAMPLE
|
||||
|
||||
And turn it into something more useful. The symbols before the tag
|
||||
names (numbers) have the following meaning:
|
||||
|
||||
- =#= :: This tag is currently active.
|
||||
- =-= :: This tag is visible on another monitor.
|
||||
- =:= :: This tag isn't displayed, but has windows on it.
|
||||
- =.= :: This tag isn't displayed and is empty.
|
||||
- =!= :: This tag has an urgent window on it.
|
||||
|
||||
First the tag line has to be split into separate parts. Each tag
|
||||
status/name pair is split by a tab character and each status is only
|
||||
one character. So I split the whole string on tabs and then make a
|
||||
list out of each individual part, for easy access to the status
|
||||
character. So we end up with something like:
|
||||
|
||||
#+BEGIN_EXAMPLE
|
||||
((#\# #\1) (#\- #\2) (#\: #\3) ...)
|
||||
#+END_EXAMPLE
|
||||
|
||||
#+BEGIN_SRC scheme
|
||||
(define (split-tag-list str)
|
||||
(map string->list (string-split str "\t")))
|
||||
#+END_SRC
|
||||
|
||||
Next we turn each part into something practical for display in
|
||||
mowedline.
|
||||
|
||||
#+BEGIN_SRC scheme
|
||||
(define tag-display
|
||||
(match-lambda
|
||||
((#\# . name-list)
|
||||
(list '(color "#ececec" font "FontAwesome-10" "")
|
||||
(string-append " " (list->string name-list) " ")))
|
||||
((#\- . _) '((color "#bfbfbf" font "FontAwesome-10" "") " "))
|
||||
((#\. . _) '((color "#969696" font "FontAwesome-10" "") " "))
|
||||
((#\: . _) '((color "#969696" font "FontAwesome-10" "") " "))
|
||||
((#\! . _) '((color "#a85454" font "FontAwesome-10" "") " "))))
|
||||
|
||||
(define (tag-list-display tag-list)
|
||||
(map tag-display tag-list))
|
||||
#+END_SRC
|
||||
|
||||
Finally, bring it all together in a function that can be used as a
|
||||
mowedline text formatter.
|
||||
|
||||
#+BEGIN_SRC scheme
|
||||
(define (tag-list-formatter text)
|
||||
(tag-list-display (split-tag-list text)))
|
||||
#+END_SRC
|
||||
|
||||
Create a mowedline window, put it at the bottom.
|
||||
|
||||
#+BEGIN_SRC scheme
|
||||
(window #:position 'bottom
|
||||
#:width 1843
|
||||
#:margin-bottom 15
|
||||
#:margin-left 46
|
||||
#:margin-right 15
|
||||
#:background 'transparent
|
||||
|
||||
(widget:text #:name "taglist" #:format tag-list-formatter)
|
||||
(widget:spacer #:flex 1)
|
||||
(widget:clock))
|
||||
#+END_SRC
|
1
mowedline/.gitignore
vendored
Normal file
1
mowedline/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
init.scm
|
6
mowedline/GNUmakefile
Normal file
6
mowedline/GNUmakefile
Normal file
|
@ -0,0 +1,6 @@
|
|||
include ../dotfiles.mk
|
||||
|
||||
all: .config/mowedline/init.scm
|
||||
|
||||
%.scm: %.org
|
||||
$(call tangle,scheme)
|
Loading…
Reference in a new issue