Merge branch '107-integrate-simple-timer-into-polybar' into 'master'
Resolve "Integrate simple timer into polybar" Closes #107 See merge request marty-oehme/dotfiles!35
This commit is contained in:
commit
5aad473ab5
6 changed files with 63 additions and 3 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "polybar/.local/share/pomo"]
|
||||||
|
path = polybar/.local/share/pomo
|
||||||
|
url = https://github.com/jsspencer/pomo.git
|
|
@ -57,7 +57,7 @@ padding-left = 0
|
||||||
padding-right = 0
|
padding-right = 0
|
||||||
module-margin-left = 2
|
module-margin-left = 2
|
||||||
|
|
||||||
modules-left = workspaces
|
modules-left = workspaces pomo
|
||||||
modules-center = music date papersdue
|
modules-center = music date papersdue
|
||||||
modules-right = networkspeed archupdates cpu temp backlight volume battery
|
modules-right = networkspeed archupdates cpu temp backlight volume battery
|
||||||
; do not use offsets for the bar, would only work with override-redirect
|
; do not use offsets for the bar, would only work with override-redirect
|
||||||
|
@ -212,6 +212,7 @@ time-alt = %H:%M
|
||||||
label = %date% %{T2} %{T-}%time%
|
label = %date% %{T2} %{T-}%time%
|
||||||
|
|
||||||
; display information on currently playing track, allows simple track manipulation
|
; display information on currently playing track, allows simple track manipulation
|
||||||
|
; TODO: add album art display (on click?) - retrieved by playerctl metadata mpris:artUrl
|
||||||
[module/music]
|
[module/music]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-mprisdisplay
|
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-mprisdisplay
|
||||||
|
@ -219,7 +220,6 @@ exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-mprisdisplay
|
||||||
tail = true
|
tail = true
|
||||||
click-left = kill -USR1 %pid%
|
click-left = kill -USR1 %pid%
|
||||||
click-right = kill -USR2 %pid%
|
click-right = kill -USR2 %pid%
|
||||||
; TODO: add album art display (on click?) - retrieved by playerctl metadata mpris:artUrl
|
|
||||||
|
|
||||||
; display information on remaining papers to read for the upcoming week
|
; display information on remaining papers to read for the upcoming week
|
||||||
[module/papersdue]
|
[module/papersdue]
|
||||||
|
@ -227,11 +227,25 @@ type = custom/script
|
||||||
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-papersdue
|
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-papersdue
|
||||||
exec-if = type bib-due
|
exec-if = type bib-due
|
||||||
tail = true
|
tail = true
|
||||||
|
; show list with high prio
|
||||||
click-left = exist rofi-bib-due normal "opening due papers" && rofi-bib-due -p1 -u $(date --date='fri this week' +%Y-%m-%d)
|
click-left = exist rofi-bib-due normal "opening due papers" && rofi-bib-due -p1 -u $(date --date='fri this week' +%Y-%m-%d)
|
||||||
|
; show list with all
|
||||||
|
click-right = exist rofi-bib-due normal "opening due papers" && rofi-bib-due -p3 -u $(date --date='fri this week' +%Y-%m-%d)
|
||||||
; format-foreground = ${colors.primary}
|
; format-foreground = ${colors.primary}
|
||||||
format-prefix = " "
|
format-prefix = " "
|
||||||
interval = 120
|
interval = 120
|
||||||
|
|
||||||
|
; displays a small pomodoro timer
|
||||||
|
[module/pomo]
|
||||||
|
type = custom/script
|
||||||
|
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-pomo
|
||||||
|
exec-if = exist pomo normal "pomodoro timer"
|
||||||
|
; pause timer
|
||||||
|
click-left = $XDG_CONFIG_HOME/polybar/scripts/poly-pomo toggle
|
||||||
|
; restart timer
|
||||||
|
click-right = $XDG_CONFIG_HOME/polybar/scripts/poly-pomo restart
|
||||||
|
tail = true
|
||||||
|
|
||||||
; display unified available packages for update on arch from repos/aur
|
; display unified available packages for update on arch from repos/aur
|
||||||
; uses pacman-contrib/checkupdates if available to avoid partial arch upgrades
|
; uses pacman-contrib/checkupdates if available to avoid partial arch upgrades
|
||||||
[module/archupdates]
|
[module/archupdates]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
all="$(bib-due -u 'fri this week' | wc -l)"
|
all="$(bib-due -u 'fri this week' -p3 | wc -l)"
|
||||||
required="$(bib-due -u 'fri this week' -p1 | wc -l)"
|
required="$(bib-due -u 'fri this week' -p1 | wc -l)"
|
||||||
|
|
||||||
# add polybar formatting to color required readings red
|
# add polybar formatting to color required readings red
|
||||||
|
|
41
polybar/.config/polybar/scripts/poly-pomo
Executable file
41
polybar/.config/polybar/scripts/poly-pomo
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
run_notify() {
|
||||||
|
pomo notify &
|
||||||
|
PID_NOTIFY="$!"
|
||||||
|
echo "$PID_NOTIFY" >"${XDG_RUNTIME_DIR:-$HOME}"/.running-pomo.lock
|
||||||
|
}
|
||||||
|
|
||||||
|
# create background notify process; close it when this process is killed
|
||||||
|
close_notify() {
|
||||||
|
lockfile="${XDG_RUNTIME_DIR:-$HOME}"/.running-pomo.lock
|
||||||
|
[ -f "$lockfile" ] && kill "$(cat "$lockfile")"
|
||||||
|
kill "$PID_NOTIFY"
|
||||||
|
rm "${XDG_RUNTIME_DIR:-$HOME}"/.running-pomo.lock
|
||||||
|
}
|
||||||
|
trap close_notify EXIT
|
||||||
|
|
||||||
|
restart_notify() {
|
||||||
|
close_notify
|
||||||
|
run_notify
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
run_notify
|
||||||
|
while true; do
|
||||||
|
display=$(pomo clock)
|
||||||
|
# replace W (work)
|
||||||
|
# B (break)
|
||||||
|
# P (paused) with pomodoro symbols
|
||||||
|
# remove seconds *except for* when 00 minutes reached
|
||||||
|
display=$(echo "$display" | sed -e 's/P.*$/ /;s/W/ /;s/B/ /;/00:/! { s/:[[:digit:]]\+$// }')
|
||||||
|
echo "$display"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
elif [ "$1" = "toggle" ]; then
|
||||||
|
pomo pause
|
||||||
|
restart_notify
|
||||||
|
elif [ "$1" = "restart" ]; then
|
||||||
|
pomo stop && pomo start
|
||||||
|
restart_notify
|
||||||
|
fi
|
1
polybar/.local/bin/pomo
Symbolic link
1
polybar/.local/bin/pomo
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../share/pomo/pomo.sh
|
1
polybar/.local/share/pomo
Submodule
1
polybar/.local/share/pomo
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 68a8e26a46f8516ee73b429c153a1fc7a4a2c300
|
Loading…
Reference in a new issue