mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
fix(polybar): GNU uptime for aw-afk, bind:utils for ipstack-vpn
This commit is contained in:
parent
12e25acdeb
commit
557a6765d8
4 changed files with 17 additions and 11 deletions
|
|
@ -30,9 +30,10 @@
|
|||
"flameshot"
|
||||
"rofi"
|
||||
"sunwait"
|
||||
"dateutils"
|
||||
"jq"
|
||||
"curl"
|
||||
"bind"
|
||||
"bind:utils"
|
||||
"polybar"
|
||||
"i3-gaps"
|
||||
"xsettingsd"
|
||||
|
|
|
|||
17
Desktop.org
17
Desktop.org
|
|
@ -764,9 +764,9 @@ declare -A BAR_HEIGHT=(
|
|||
["HDMI-A-0"]="29"
|
||||
)
|
||||
declare -A BLOCKS=(
|
||||
["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun date TSEP"
|
||||
["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun date TSEP"
|
||||
["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun date TSEP"
|
||||
["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP"
|
||||
["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP"
|
||||
["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun aw-afk date TSEP"
|
||||
)
|
||||
|
||||
# Geolocation for some modules
|
||||
|
|
@ -887,7 +887,7 @@ If you want to copy something, you can go to the [[file:bin/polybar/][bin/polyba
|
|||
*** ipstack-vpn
|
||||
| Guix dependency | Description |
|
||||
|-----------------+-------------------------|
|
||||
| bind | Provides dig |
|
||||
| bind:utils | Provides dig |
|
||||
| curl | |
|
||||
| jq | util to work with JSONs |
|
||||
|
||||
|
|
@ -951,17 +951,20 @@ interval = 1200
|
|||
*** aw-afk
|
||||
Prints out a current uptime and non-AFK time from [[https://github.com/ActivityWatch][ActivityWatch]] server
|
||||
|
||||
| Guix dependency |
|
||||
|-----------------|
|
||||
| dateutils |
|
||||
|
||||
| Type | Note |
|
||||
|------+--------------------------------------------|
|
||||
| TODO | Fix crash on uptime > 99h |
|
||||
| TODO | Fix non-compatible uptime in GNU coreutils |
|
||||
|
||||
#+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")
|
||||
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")
|
||||
|
||||
uptime=$(datediff "$(uptime -s | xargs -I ! date -d ! -Iseconds)" "$(date -Iseconds)" -f '%H:%M' | xargs -I ! date -d ! +"%H:%M")
|
||||
uptime=$(datediff "$(uptime | awk '{ print substr($3, 0, length($3) - 1) }' | xargs -I ! date -d ! -Iseconds)" "$(date -Iseconds)" -f '%H:%M' | xargs -I ! date -d ! +"%H:%M")
|
||||
res="${afk_time} / ${uptime}"
|
||||
if [[ $status == 'afk' ]]; then
|
||||
echo "%{u<<get-color(name="red")>>}%{+u} [AFK] $res %{u-}"
|
||||
|
|
@ -2051,6 +2054,8 @@ This section generates manifests for various desktop software that I'm using.
|
|||
| dev | docker-compose |
|
||||
| dev | python |
|
||||
| dev | postgresql |
|
||||
| dev | jupyter |
|
||||
| dev | python-pyqt |
|
||||
** Manifests
|
||||
#+NAME: packages
|
||||
#+begin_src emacs-lisp :tangle no :var category=""
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ declare -A BAR_HEIGHT=(
|
|||
["HDMI-A-0"]="29"
|
||||
)
|
||||
declare -A BLOCKS=(
|
||||
["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun date TSEP"
|
||||
["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun date TSEP"
|
||||
["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun date TSEP"
|
||||
["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP"
|
||||
["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP"
|
||||
["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun aw-afk date TSEP"
|
||||
)
|
||||
|
||||
# Geolocation for some modules
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ afk_event=$(curl -s -X GET "http://localhost:5600/api/0/buckets/aw-watcher-afk_$
|
|||
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")
|
||||
|
||||
uptime=$(datediff "$(uptime -s | xargs -I ! date -d ! -Iseconds)" "$(date -Iseconds)" -f '%H:%M' | xargs -I ! date -d ! +"%H:%M")
|
||||
uptime=$(datediff "$(uptime | awk '{ print substr($3, 0, length($3) - 1) }' | xargs -I ! date -d ! -Iseconds)" "$(date -Iseconds)" -f '%H:%M' | xargs -I ! date -d ! +"%H:%M")
|
||||
res="${afk_time} / ${uptime}"
|
||||
if [[ $status == 'afk' ]]; then
|
||||
echo "%{u#f07178}%{+u} [AFK] $res %{u-}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue