feat(desktop): use Xresources

This commit is contained in:
Pavel Korytov 2021-05-01 18:52:59 +03:00
parent 6b70df8719
commit fe7ad2de8f
10 changed files with 279 additions and 170 deletions

22
.Xresources Normal file
View file

@ -0,0 +1,22 @@
! [[file:Desktop.org::*Xresources][Xresources:2]]
*color0: #292d3e
*color1: #f07178
*color2: #c3e88d
*color3: #ffcb6b
*color4: #82aaff
*color5: #c792ea
*color6: #89ddff
*color7: #d0d0d0
*color8: #434758
*color9: #ff8b92
*color10: #ddffa7
*color11: #ffe585
*color12: #9cc4ff
*color13: #e1acff
*color14: #a3f7ff
*color15: #ffffff
*background: #292d3e
*foreground: #d0d0d0
! Xresources:2 ends here

View file

@ -1,4 +1,4 @@
# [[file:../../Shell.org::*Alacritty][Alacritty:1]] # [[file:../../Console.org::*Alacritty][Alacritty:3]]
decorations: none decorations: none
font: font:
@ -7,10 +7,10 @@ font:
style: Regular style: Regular
size: 10 size: 10
env: env:
TERM: xterm-256color TERM: xterm-256color
colors: colors:
primary: primary:
background: '#292d3e' background: '#292d3e'
@ -67,4 +67,4 @@ key_bindings:
- { key: NumpadAdd, mods: Control, action: IncreaseFontSize } - { key: NumpadAdd, mods: Control, action: IncreaseFontSize }
- { key: Minus, mods: Control, action: DecreaseFontSize } - { key: Minus, mods: Control, action: DecreaseFontSize }
- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } - { key: NumpadSubtract, mods: Control, action: DecreaseFontSize }
# Alacritty:1 ends here # Alacritty:3 ends here

View file

@ -51,7 +51,7 @@
frame_width = 1 frame_width = 1
# Defines color of the frame around the notification window. # Defines color of the frame around the notification window.
frame_color = "#aaaaaa" frame_color = "#d0d0d0"
# Define a color for the separator. # Define a color for the separator.
# possible values are: # possible values are:
@ -263,16 +263,16 @@
# IMPORTANT: colors have to be defined in quotation marks. # IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment. # Otherwise the "#" and following would be interpreted as a comment.
background = "#434758" background = "#434758"
frame_color = "#ffffff" frame_color = "#d0d0d0"
foreground = "#d0d0d0" foreground = "#ffffff"
timeout = 10 timeout = 10
# Icon for notifications with low urgency, uncomment to enable # Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon #icon = /path/to/icon
[urgency_normal] [urgency_normal]
background = "#292d3e" background = "#292d3e"
foreground = "#d0d0d0" frame_color = "#d0d0d0"
frame_color = "#ffffff" foreground = "#ffffff"
timeout = 10 timeout = 10
# Icon for notifications with normal urgency, uncomment to enable # Icon for notifications with normal urgency, uncomment to enable
#icon = /path/to/icon #icon = /path/to/icon

View file

@ -336,20 +336,22 @@ bindsym --release Shift+Print exec "xfce4-screenshooter"
# Screenshots:1 ends here # Screenshots:1 ends here
# [[file:../../Desktop.org::*Colors][Colors:1]] # [[file:../../Desktop.org::*Colors][Colors:1]]
exec xrdb -merge $HOME/.Xresources
# Colors # Colors
set $bg-color #292d3e set_from_resource $bg-color background
set $active-color #82aaff set_from_resource $active-color color4
set $inactive-bg-color #434758 set_from_resource $inactive-bg-color color8
set $text-color #f3f4f5 set_from_resource $text-color foreground
set $inactive-text-color #aaaaaa set_from_resource $inactive-text-color color7
set $urgent-bg-color #f07178 set_from_resource $urgent-bg-color color1
set $urgent-text-color #000000 set_from_resource $urgent-text-color color0
# window colors # window colors
# border background text indicator child border # border background text indicator child border
client.focused $active-color $bg-color $text-color $bg-color $active-color client.focused $active-color $bg-color $text-color $bg-color $active-color
client.unfocused $bg-color $inactive-bg-color $inactive-text-color $bg-color $bg-color client.unfocused $bg-color $inactive-bg-color $inactive-text-color $bg-color $bg-color
client.focused_inactive $active-color $inactive-bg-color $inactive-text-color $bg-color $bg-color client.focused_inactive $active-color $inactive-bg-color $inactive-text-color $bg-color $bg-color
client.urgent $urgent-bg-color $urgent-bg-color $urgent-text-color $bg-color $urgent-bg-color client.urgent $urgent-bg-color $urgent-bg-color $urgent-text-color $bg-color $urgent-bg-color
# Colors:1 ends here # Colors:1 ends here

View file

@ -1,27 +1,26 @@
; [[file:../../Desktop.org::*Colors][Colors:1]] ; [[file:../../Desktop.org::*Colors][Colors:1]]
[colors] [colors]
; Palenight colorscheme https://github.com/JonathanSpeek/palenight-iterm2 ; Palenight colorscheme https://github.com/JonathanSpeek/palenight-iterm2
black = #292d3e black = ${xrdb:color0}
red = #f07178 red = ${xrdb:color1}
green = #c3e88d green = ${xrdb:color2}
yellow = #ffcb6b yellow = ${xrdb:color3}
blue = #82aaff blue = ${xrdb:color4}
magenta = #c792ea magenta = ${xrdb:color5}
cyan = #89ddff cyan = ${xrdb:color6}
white = #d0d0d0 white = ${xrdb:color7}
black-lighter = #434758 black-lighter = ${xrdb:color8}
red-lighter = #ff8b92 red-lighter = ${xrdb:color9}
green-lighter = #ddffa7 green-lighter = ${xrdb:color10}
yellow-lighter = #ffe585 yellow-lighter = ${xrdb:color11}
blue-lighter = #9cc4ff blue-lighter = ${xrdb:color12}
magenta-lighter = #9cc4ff magenta-lighter = ${xrdb:color13}
cyan-lighter = #9cc4ff cyan-lighter = ${xrdb:color14}
white-lighter = ffffff white-lighter = ${xrdb:color15}
background = ${colors.black} background = ${xrdb:background}
; background = #ee292d3e foreground = ${xrdb:foreground}
foreground = ${colors.white}
; Colors:1 ends here ; Colors:1 ends here
; [[file:../../Desktop.org::*Bar config][Bar config:1]] ; [[file:../../Desktop.org::*Bar config][Bar config:1]]
@ -293,7 +292,7 @@ ramp-signal-0 = 0
ramp-signal-1 = 1 ramp-signal-1 = 1
ramp-signal-2 = 2 ramp-signal-2 = 2
ramp-signal-3 = 3 ramp-signal-3 = 3
ramp-signal-4 = 4 ramp-signal-4 = 4
ramp-signal-5 = 5 ramp-signal-5 = 5
; network:1 ends here ; network:1 ends here

View file

@ -5,26 +5,26 @@
green: #c3e88d; green: #c3e88d;
yellow: #ffcb6b; yellow: #ffcb6b;
blue: #82aaff; blue: #82aaff;
magenta: #82aaff; magenta: #c792ea;
cyan: #89ddff; cyan: #89ddff;
white: #d0d0d0; white: #d0d0d0;
black-alternate: #393F57; light-black: #434758;
black-lighter: #434758; light-red: #ff8b92;
red-lighter: #ff8b92; light-green: #ddffa7;
green-lighter: #ddffa7; light-yellow: #ffe585;
yellow-lighter: #ffe585; light-blue: #9cc4ff;
blue-lighter: #9cc4ff; light-magenta: #e1acff;
magenta-lighter: #e1acff; light-cyan: #a3f7ff;
cyan-lighter: #a3f7ff; light-white: #ffffff;
white-lighter: #ffffff;
foreground: @white; foreground: @white;
background: @black; background: @black;
background-color: @black; background-color: @black;
separatorcolor: @magenta; separatorcolor: @blue;
border-color: @magenta; border-color: @blue;
selected-normal-foreground: @black; selected-normal-foreground: @black;
selected-normal-background: @magenta; selected-normal-background: @blue;
selected-active-foreground: @black; selected-active-foreground: @black;
selected-active-background: @blue; selected-active-background: @blue;
selected-urgent-foreground: @foreground; selected-urgent-foreground: @foreground;
@ -36,11 +36,11 @@
urgent-foreground: @red; urgent-foreground: @red;
urgent-background: @background; urgent-background: @background;
alternate-normal-foreground: @foreground; alternate-normal-foreground: @foreground;
alternate-normal-background: @black-alternate; alternate-normal-background: @light-black;
alternate-active-foreground: @blue; alternate-active-foreground: @blue;
alternate-active-background: @black-alternate; alternate-active-background: @light-black;
alternate-urgent-foreground: @red; alternate-urgent-foreground: @red;
alternate-urgent-background: @black-alternate; alternate-urgent-background: @light-black;
spacing: 2; spacing: 2;
} }
window { window {

View file

@ -1,3 +1,4 @@
# [[file:../../Desktop.org::*Zathura][Zathura:1]]
set abort-clear-search false set abort-clear-search false
set show-scrollbars true set show-scrollbars true
set show-h-scrollbar true set show-h-scrollbar true
@ -7,3 +8,4 @@ set recolor-lightcolor "#292d3e"
set recolor true set recolor true
map <C-r> set recolor false map <C-r> set recolor false
map <C-R> set recolor true map <C-R> set recolor true
# Zathura:1 ends here

View file

@ -469,10 +469,21 @@ source ~/.tmux.line.conf
[[https://github.com/alacritty/alacritty][Alacritty]] is a GPU-accelerated terminal emulator. I haven't found it to be an inch faster than st, but configuration the in yml format is way more convinient than patches. [[https://github.com/alacritty/alacritty][Alacritty]] is a GPU-accelerated terminal emulator. I haven't found it to be an inch faster than st, but configuration the in yml format is way more convinient than patches.
Once again, we have an application which doesn't support reading Xresources, so here goes noweb.
#+name: get-xrdb
#+begin_src bash :var color="color0" :tangle no
xrdb -query all | grep "$color:" | cut -f 2
#+end_src
#+begin_src emacs-lisp :tangle no
(setq-local org-confirm-babel-evaluate nil)
#+end_src
References: References:
- [[https://github.com/alacritty/alacritty/blob/master/alacritty.yml][default config]] - [[https://github.com/alacritty/alacritty/blob/master/alacritty.yml][default config]]
#+begin_src yaml #+begin_src yaml :noweb yes
decorations: none decorations: none
font: font:
@ -481,32 +492,32 @@ font:
style: Regular style: Regular
size: 10 size: 10
env: env:
TERM: xterm-256color TERM: xterm-256color
colors: colors:
primary: primary:
background: '#292d3e' background: '<<get-xrdb(color="color0")>>'
foreground: '#d0d0d0' foreground: '<<get-xrdb(color="color7")>>'
normal: normal:
black: '#292d3e' black: '<<get-xrdb(color="color0")>>'
red: '#f07178' red: '<<get-xrdb(color="color1")>>'
green: '#c3e88d' green: '<<get-xrdb(color="color2")>>'
yellow: '#ffcb6b' yellow: '<<get-xrdb(color="color3")>>'
blue: '#82aaff' blue: '<<get-xrdb(color="color4")>>'
magenta: '#c792ea' magenta: '<<get-xrdb(color="color5")>>'
cyan: '#89ddff' cyan: '<<get-xrdb(color="color6")>>'
white: '#d0d0d0' white: '<<get-xrdb(color="color7")>>'
bright: bright:
Black: '#434758' Black: '<<get-xrdb(color="color8")>>'
Red: '#ff8b92' Red: '<<get-xrdb(color="color9")>>'
Green: '#ddffa7' Green: '<<get-xrdb(color="color10")>>'
Yellow: '#ffe585' Yellow: '<<get-xrdb(color="color11")>>'
Blue: '#9cc4ff' Blue: '<<get-xrdb(color="color12")>>'
Magenta: '#e1acff' Magenta: '<<get-xrdb(color="color13")>>'
Cyan: '#a3f7ff' Cyan: '<<get-xrdb(color="color14")>>'
White: '#ffffff' White: '<<get-xrdb(color="color15")>>'
background_opacity: 0.80 background_opacity: 0.80

View file

@ -1,28 +1,17 @@
#+TITLE: Desktop #+TITLE: Desktop
#+TODO: TODO(t) CHECK(s) | OFF(o) #+TODO: TODO(t) CHECK(s) | OFF(o)
#+PROPERTY: header-args :mkdirp yes #+PROPERTY: header-args :mkdirp yes
#+PROPERTY: header-args:conf-space :comments link #+PROPERTY: header-args:conf-space :comments link
#+PROPERTY: header-args:conf-unix :comments link #+PROPERTY: header-args:conf-unix :comments link
#+PROPERTY: header-args:conf-windows :comments link #+PROPERTY: header-args:conf-windows :comments link
#+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/bin/sh" #+PROPERTY: header-args:conf-xdefaults :comments link
#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/bin/bash" #+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/bin/sh"
#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/bin/bash"
My general desktop environment configuration. My general desktop environment configuration.
Parts prefixed with (OFF) are not used, but kept for historic purposes. For some reason GitHub's org renderer ignores TODO status, hence such a prefix. Round brackets instead of square ones to prevent GitHub's org renderer from screwing up. Parts prefixed with (OFF) are not used, but kept for historic purposes. For some reason GitHub's org renderer ignores TODO status, hence such a prefix. Round brackets instead of square ones to prevent GitHub's org renderer from screwing up.
Most of the colors are from the Palenight theme. Colorcodes are taken from [[https://github.com/JonathanSpeek/palenight-iterm2][this repo]]:
| Color | Default | Lighter |
|---------+---------+---------|
| Black | #292d3e | #434758 |
| Red | #f07178 | #ff8b92 |
| Green | #c3e88d | #ddffa7 |
| Yellow | #ffcb6b | #ffe585 |
| Blue | #82aaff | #9cc4ff |
| Magenta | #c792ea | #e1acff |
| Cyan | #89ddff | #a3f7ff |
| White | #d0d0d0 | #ffffff |
* Contents * Contents
:PROPERTIES: :PROPERTIES:
@ -30,6 +19,8 @@ Most of the colors are from the Palenight theme. Colorcodes are taken from [[htt
:END: :END:
:CONTENTS: :CONTENTS:
- [[#contents][Contents]] - [[#contents][Contents]]
- [[#colors][Colors]]
- [[#xresources][Xresources]]
- [[#i3wm][i3wm]] - [[#i3wm][i3wm]]
- [[#general-settings][General settings]] - [[#general-settings][General settings]]
- [[#managing-windows][Managing windows]] - [[#managing-windows][Managing windows]]
@ -88,7 +79,76 @@ Most of the colors are from the Palenight theme. Colorcodes are taken from [[htt
- [[#fading][Fading]] - [[#fading][Fading]]
- [[#opacity][Opacity]] - [[#opacity][Opacity]]
- [[#general-settings][General settings]] - [[#general-settings][General settings]]
- [[#zathura][Zathura]]
:END: :END:
* Colors
Most of the colors are from the Palenight theme. Colorcodes are taken from [[https://github.com/JonathanSpeek/palenight-iterm2][this repo]]:
#+tblname: colors
| color | key | value |
|---------------+---------+---------|
| black | color0 | #292d3e |
| red | color1 | #f07178 |
| green | color2 | #c3e88d |
| yellow | color3 | #ffcb6b |
| blue | color4 | #82aaff |
| magenta | color5 | #c792ea |
| cyan | color6 | #89ddff |
| white | color7 | #d0d0d0 |
| light-black | color8 | #434758 |
| light-red | color9 | #ff8b92 |
| light-green | color10 | #ddffa7 |
| light-yellow | color11 | #ffe585 |
| light-blue | color12 | #9cc4ff |
| light-magenta | color13 | #e1acff |
| light-cyan | color14 | #a3f7ff |
| light-white | color15 | #ffffff |
The table above is the only source of truth for colors in this config.
The first way to get colors of it is to use the following noweb:
#+NAME: get-color
#+begin_src emacs-lisp :var table=colors name="black" quote=0
(let ((color (seq-some (lambda (e) (and (string= name (car e)) (nth 2 e))) table)))
(if (> quote 0)
(concat "\"" color "\"")
color))
#+end_src
Also, run the following to disable configuration for noweb evaluations:
#+begin_src emacs-lisp
(setq-local org-confirm-babel-evaluate nil)
#+end_src
Test:
#+begin_src emacs-lisp :noweb yes
<<get-color(name="red", quote=1)>>
#+end_src
#+RESULTS:
: #f07178
** Xresources
However, I'd rather use the =Xresources= file is mostly easier. Here is the code to generate an Xresources file from this table:
#+NAME: get-xresources
#+begin_src emacs-lisp :var table=colors
(apply
#'concat
(mapcar
(lambda (elem)
(concat "*" (nth 1 elem) ": " (nth 2 elem) "\n"))
(seq-filter
(lambda (elem) (nth 1 elem))
table)))
#+end_src
#+begin_src conf-xdefaults :noweb yes :tangle ~/.Xresources
<<get-xresources()>>
*background: <<get-color(name="black")>>
*foreground: <<get-color(name="white")>>
#+end_src
* i3wm * i3wm
:PROPERTIES: :PROPERTIES:
:header-args+: :tangle ./.config/i3/config :header-args+: :tangle ./.config/i3/config
@ -493,22 +553,24 @@ bindsym --release Print exec "flameshot gui"
bindsym --release Shift+Print exec "xfce4-screenshooter" bindsym --release Shift+Print exec "xfce4-screenshooter"
#+end_src #+end_src
** Colors ** Colors
Application of the palenight theme to the WM. Application of the XResources theme to the WM.
#+begin_src conf-space #+begin_src conf-space
exec xrdb -merge $HOME/.Xresources
# Colors # Colors
set $bg-color #292d3e set_from_resource $bg-color background
set $active-color #82aaff set_from_resource $active-color color4
set $inactive-bg-color #434758 set_from_resource $inactive-bg-color color8
set $text-color #f3f4f5 set_from_resource $text-color foreground
set $inactive-text-color #aaaaaa set_from_resource $inactive-text-color color7
set $urgent-bg-color #f07178 set_from_resource $urgent-bg-color color1
set $urgent-text-color #000000 set_from_resource $urgent-text-color color0
# window colors # window colors
# border background text indicator child border # border background text indicator child border
client.focused $active-color $bg-color $text-color $bg-color $active-color client.focused $active-color $bg-color $text-color $bg-color $active-color
client.unfocused $bg-color $inactive-bg-color $inactive-text-color $bg-color $bg-color client.unfocused $bg-color $inactive-bg-color $inactive-text-color $bg-color $bg-color
client.focused_inactive $active-color $inactive-bg-color $inactive-text-color $bg-color $bg-color client.focused_inactive $active-color $inactive-bg-color $inactive-text-color $bg-color $bg-color
client.urgent $urgent-bg-color $urgent-bg-color $urgent-text-color $bg-color $urgent-bg-color client.urgent $urgent-bg-color $urgent-bg-color $urgent-text-color $bg-color $urgent-bg-color
#+end_src #+end_src
** OFF (OFF) i3blocks ** OFF (OFF) i3blocks
@ -684,27 +746,26 @@ done
#+begin_src conf-windows #+begin_src conf-windows
[colors] [colors]
; Palenight colorscheme https://github.com/JonathanSpeek/palenight-iterm2 ; Palenight colorscheme https://github.com/JonathanSpeek/palenight-iterm2
black = #292d3e black = ${xrdb:color0}
red = #f07178 red = ${xrdb:color1}
green = #c3e88d green = ${xrdb:color2}
yellow = #ffcb6b yellow = ${xrdb:color3}
blue = #82aaff blue = ${xrdb:color4}
magenta = #c792ea magenta = ${xrdb:color5}
cyan = #89ddff cyan = ${xrdb:color6}
white = #d0d0d0 white = ${xrdb:color7}
black-lighter = #434758 black-lighter = ${xrdb:color8}
red-lighter = #ff8b92 red-lighter = ${xrdb:color9}
green-lighter = #ddffa7 green-lighter = ${xrdb:color10}
yellow-lighter = #ffe585 yellow-lighter = ${xrdb:color11}
blue-lighter = #9cc4ff blue-lighter = ${xrdb:color12}
magenta-lighter = #9cc4ff magenta-lighter = ${xrdb:color13}
cyan-lighter = #9cc4ff cyan-lighter = ${xrdb:color14}
white-lighter = ffffff white-lighter = ${xrdb:color15}
background = ${colors.black} background = ${xrdb:background}
; background = #ee292d3e foreground = ${xrdb:foreground}
foreground = ${colors.white}
#+end_src #+end_src
*** Bar config *** Bar config
#+begin_src conf-windows #+begin_src conf-windows
@ -766,14 +827,17 @@ margin-top = 0
margin-bottom = 0 margin-bottom = 0
#+end_src #+end_src
** Modules ** Modules
Some of the custom modules below use Org mode noweb to evaluate colors, because it's faster than querying =xrdb= at runtime. I wish I could reference polybar values there, but [[https://github.com/polybar/polybar/issues/615][it looks like this is impossible]].
If you want to copy something, you can go to the [[file:bin/polybar/][bin/polybar]] folder.
*** ipstack-vpn *** ipstack-vpn
A module to get a country of the current IP and openvpn status. Uses [[https://ipstack.com/][ipstack]] API. A module to get a country of the current IP and openvpn status. Uses [[https://ipstack.com/][ipstack]] API.
#+begin_src bash :tangle ./bin/polybar/ipstack-vpn.sh #+begin_src bash :tangle ./bin/polybar/ipstack-vpn.sh :noweb yes
ip=$(dig +short +timeout=1 myip.opendns.com @resolver1.opendns.com 2> /dev/null) ip=$(dig +short +timeout=1 myip.opendns.com @resolver1.opendns.com 2> /dev/null)
API_KEY="$(cat ~/secrets/ipstack-api-key)" API_KEY="$(cat ~/secrets/ipstack-api-key)"
if [[ -z $ip || $ip == *"timed out"* ]]; then if [[ -z $ip || $ip == *"timed out"* ]]; then
echo "%{u#f07178}%{+u} ?? %{u-}" echo "%{u<<get-color(name="red")>>}%{+u} ?? %{u-}"
exit exit
fi fi
ip_info=$(curl -s http://api.ipstack.com/${ip}?access_key=${API_KEY}) ip_info=$(curl -s http://api.ipstack.com/${ip}?access_key=${API_KEY})
@ -782,9 +846,9 @@ code=$(echo $ip_info | jq -r '.country_code')
vpn=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1) vpn=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1)
if [ -n "$vpn" ]; then if [ -n "$vpn" ]; then
echo "%{u#9cc4ff}%{+u}  $code %{u-}" echo "%{u<<get-color(name="blue")>>}%{+u}  $code %{u-}"
else else
echo "%{u#f07178}%{+u}  $code %{u-}" echo "%{u<<get-color(name="red")>>}%{+u}  $code %{u-}"
fi fi
#+end_src #+end_src
@ -827,7 +891,7 @@ Prints out a current uptime and non-AFK time from [[https://github.com/ActivityW
|------+---------------------------| |------+---------------------------|
| TODO | Fix crash on uptime > 99h | | TODO | Fix crash on uptime > 99h |
#+begin_src bash :tangle ./bin/polybar/aw_afk.sh #+begin_src bash :tangle ./bin/polybar/aw_afk.sh :noweb yes
afk_event=$(curl -s -X GET "http://localhost:5600/api/0/buckets/aw-watcher-afk_$(hostname)/events?limit=1" -H "accept: application/json") afk_event=$(curl -s -X GET "http://localhost:5600/api/0/buckets/aw-watcher-afk_$(hostname)/events?limit=1" -H "accept: application/json")
status=$(echo ${afk_event} | jq -r '.[0].data.status') status=$(echo ${afk_event} | jq -r '.[0].data.status')
afk_time=$(echo "${afk_event}" | jq -r '.[0].duration' | xargs -I ! date -u -d @! +"%H:%M") afk_time=$(echo "${afk_event}" | jq -r '.[0].duration' | xargs -I ! date -u -d @! +"%H:%M")
@ -835,9 +899,9 @@ afk_time=$(echo "${afk_event}" | jq -r '.[0].duration' | xargs -I ! date -u -d
uptime=$(datediff "$(uptime -s | xargs -I ! date -d ! -Iseconds)" "$(date -Iseconds)" -f '%H:%M' | xargs -I ! date -d ! +"%H:%M") uptime=$(datediff "$(uptime -s | xargs -I ! date -d ! -Iseconds)" "$(date -Iseconds)" -f '%H:%M' | xargs -I ! date -d ! +"%H:%M")
res="${afk_time} / ${uptime}" res="${afk_time} / ${uptime}"
if [[ $status == 'afk' ]]; then if [[ $status == 'afk' ]]; then
echo "%{u#f07178}%{+u} [AFK] $res %{u-}" echo "%{u<<get-color(name="red")>>}%{+u} [AFK] $res %{u-}"
else else
echo "%{u#82aaff}%{+u} $res %{u-}" echo "%{u<<get-color(name="blue")>>}%{+u} $res %{u-}"
fi fi
#+end_src #+end_src
@ -850,7 +914,7 @@ interval = 60
*** sun *** sun
Prints out the time of sunrise/sunset. Uses [[https://github.com/risacher/sunwait][sunwait]] Prints out the time of sunrise/sunset. Uses [[https://github.com/risacher/sunwait][sunwait]]
#+begin_src bash :tangle ./bin/polybar/sun.sh #+begin_src bash :tangle ./bin/polybar/sun.sh :noweb yes
declare -A LAT_DATA=( declare -A LAT_DATA=(
["TMN"]="57.15N" ["TMN"]="57.15N"
["SPB"]="59.9375N" ["SPB"]="59.9375N"
@ -870,10 +934,10 @@ time=$(sunwait poll daylight rise ${LAT} $LON)
if [[ ${time} == 'DAY' ]]; then if [[ ${time} == 'DAY' ]]; then
sunset=$(sunwait list daylight set ${LAT} ${LON}) sunset=$(sunwait list daylight set ${LAT} ${LON})
echo "%{u#ffcb6b}%{+u} $sunset %{u-}" echo "%{u<<get-color(name="yellow")>>}%{+u} $sunset %{u-}"
else else
sunrise=$(sunwait list daylight rise ${LAT} ${LON}) sunrise=$(sunwait list daylight rise ${LAT} ${LON})
echo "%{u#f07178}%{+u} $sunrise %{u-}" echo "%{u<<get-color(name="red")>>}%{+u} $sunrise %{u-}"
fi fi
#+end_src #+end_src
@ -1089,7 +1153,7 @@ ramp-signal-0 = 0
ramp-signal-1 = 1 ramp-signal-1 = 1
ramp-signal-2 = 2 ramp-signal-2 = 2
ramp-signal-3 = 3 ramp-signal-3 = 3
ramp-signal-4 = 4 ramp-signal-4 = 4
ramp-signal-5 = 5 ramp-signal-5 = 5
#+end_src #+end_src
@ -1136,35 +1200,30 @@ ramp-capacity-4 = 
[[https://github.com/davatorium/rofi][rofi]] is another dynamic menu generator. It can act as dmenu replacement but offers a superset of dmenu's features. [[https://github.com/davatorium/rofi][rofi]] is another dynamic menu generator. It can act as dmenu replacement but offers a superset of dmenu's features.
** Theme ** Theme
A theme is based on [[https://github.com/dracula/rofi][dracula theme]] for rofi. Probably no reason to keep it in this file. A theme, based on [[https://github.com/dracula/rofi][dracula theme]] for rofi, but with palenight colorscheme.
#+begin_src conf-colon :tangle ./.config/rofi/config.rasi
#+name: get-rofi-colors
#+begin_src emacs-lisp :var table=colors
(apply
#'concat
(mapcar
(lambda (elem)
(concat (nth 0 elem) ": " (nth 2 elem) ";\n"))
table))
#+end_src
#+begin_src conf-colon :tangle ./.config/rofi/config.rasi :noweb yes
/* Generated from [[file:../../Desktop.org::*Theme][Theme:1]] */ /* Generated from [[file:../../Desktop.org::*Theme][Theme:1]] */
* { ,* {
black: #292d3e; <<get-rofi-colors()>>
red: #f07178;
green: #c3e88d;
yellow: #ffcb6b;
blue: #82aaff;
magenta: #82aaff;
cyan: #89ddff;
white: #d0d0d0;
black-alternate: #393F57;
black-lighter: #434758;
red-lighter: #ff8b92;
green-lighter: #ddffa7;
yellow-lighter: #ffe585;
blue-lighter: #9cc4ff;
magenta-lighter: #e1acff;
cyan-lighter: #a3f7ff;
white-lighter: #ffffff;
foreground: @white; foreground: @white;
background: @black; background: @black;
background-color: @black; background-color: @black;
separatorcolor: @magenta; separatorcolor: @blue;
border-color: @magenta; border-color: @blue;
selected-normal-foreground: @black; selected-normal-foreground: @black;
selected-normal-background: @magenta; selected-normal-background: @blue;
selected-active-foreground: @black; selected-active-foreground: @black;
selected-active-background: @blue; selected-active-background: @blue;
selected-urgent-foreground: @foreground; selected-urgent-foreground: @foreground;
@ -1176,11 +1235,11 @@ A theme is based on [[https://github.com/dracula/rofi][dracula theme]] for rofi.
urgent-foreground: @red; urgent-foreground: @red;
urgent-background: @background; urgent-background: @background;
alternate-normal-foreground: @foreground; alternate-normal-foreground: @foreground;
alternate-normal-background: @black-alternate; alternate-normal-background: @light-black;
alternate-active-foreground: @blue; alternate-active-foreground: @blue;
alternate-active-background: @black-alternate; alternate-active-background: @light-black;
alternate-urgent-foreground: @red; alternate-urgent-foreground: @red;
alternate-urgent-background: @black-alternate; alternate-urgent-background: @light-black;
spacing: 2; spacing: 2;
} }
window { window {
@ -1347,7 +1406,7 @@ fi
As it overwrites its own config all the time, I do not keep the file in VC. As it overwrites its own config all the time, I do not keep the file in VC.
#+begin_src conf-unix :tangle ./.config/flameshot/flameshot.ini :comments no #+begin_src conf-unix :tangle ./.config/flameshot/flameshot.ini :comments no :noweb yes
[General] [General]
disabledTrayIcon=false disabledTrayIcon=false
drawColor=#ff0000 drawColor=#ff0000
@ -1356,7 +1415,7 @@ saveAfterCopyPath=/home/pavel/Pictures
savePath=/home/pavel/Pictures savePath=/home/pavel/Pictures
savePathFixed=false savePathFixed=false
showStartupLaunchMessage=false showStartupLaunchMessage=false
uiColor=#82aaff uiColor=<<get-color(name="blue")>>
[Shortcuts] [Shortcuts]
TYPE_ARROW=A TYPE_ARROW=A
@ -1403,7 +1462,7 @@ My customizations of the original config consist mostly of changing colors.
References: References:
- [[https://dunst-project.org/documentation/][dunst documentation]] - [[https://dunst-project.org/documentation/][dunst documentation]]
#+begin_src conf-space :tangle ./.config/dunst/dunstrc #+begin_src conf-space :tangle ./.config/dunst/dunstrc :noweb yes
[global] [global]
monitor = 0 monitor = 0
@ -1456,7 +1515,7 @@ References:
frame_width = 1 frame_width = 1
# Defines color of the frame around the notification window. # Defines color of the frame around the notification window.
frame_color = "#aaaaaa" frame_color = <<get-color(name="white", quote=1)>>
# Define a color for the separator. # Define a color for the separator.
# possible values are: # possible values are:
@ -1667,25 +1726,25 @@ References:
[urgency_low] [urgency_low]
# IMPORTANT: colors have to be defined in quotation marks. # IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment. # Otherwise the "#" and following would be interpreted as a comment.
background = "#434758" background = <<get-color(name="light-black", quote=1)>>
frame_color = "#ffffff" frame_color = <<get-color(name="white", quote=1)>>
foreground = "#d0d0d0" foreground = <<get-color(name="light-white", quote=1)>>
timeout = 10 timeout = 10
# Icon for notifications with low urgency, uncomment to enable # Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon #icon = /path/to/icon
[urgency_normal] [urgency_normal]
background = "#292d3e" background = <<get-color(name="black", quote=1)>>
foreground = "#d0d0d0" frame_color = <<get-color(name="white", quote=1)>>
frame_color = "#ffffff" foreground = <<get-color(name="light-white", quote=1)>>
timeout = 10 timeout = 10
# Icon for notifications with normal urgency, uncomment to enable # Icon for notifications with normal urgency, uncomment to enable
#icon = /path/to/icon #icon = /path/to/icon
[urgency_critical] [urgency_critical]
background = "#f07178" background = <<get-color(name="red", quote=1)>>
foreground = "#ffffff" foreground = <<get-color(name="light-white", quote=1)>>
frame_color = "#f07178" frame_color = <<get-color(name="red", quote=1)>>
timeout = 0 timeout = 0
# Icon for notifications with critical urgency, uncomment to enable # Icon for notifications with critical urgency, uncomment to enable
#icon = /path/to/icon #icon = /path/to/icon
@ -1855,3 +1914,17 @@ wintypes:
dropdown_menu = { opacity = 1; } dropdown_menu = { opacity = 1; }
}; };
#+end_src #+end_src
* Zathura
[[https://pwmt.org/projects/zathura/][Zathura]] is a pdf viewer with vim-like keybindings. One of my favorite features is an ability to invert the document colors.
#+begin_src conf-space :noweb yes :tangle .config/zathura/zathurarc
set abort-clear-search false
set show-scrollbars true
set show-h-scrollbar true
set show-v-scrollbar true
set selection-clipboard clipboard
set recolor-lightcolor <<get-color(name="black", quote=1)>>
set recolor true
map <C-r> set recolor false
map <C-R> set recolor true
#+end_src

View file

@ -12,7 +12,7 @@ code=$(echo $ip_info | jq -r '.country_code')
vpn=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1) vpn=$(pgrep -a openvpn$ | head -n 1 | awk '{print $NF }' | cut -d '.' -f 1)
if [ -n "$vpn" ]; then if [ -n "$vpn" ]; then
echo "%{u#9cc4ff}%{+u}  $code %{u-}" echo "%{u#82aaff}%{+u}  $code %{u-}"
else else
echo "%{u#f07178}%{+u}  $code %{u-}" echo "%{u#f07178}%{+u}  $code %{u-}"
fi fi