From 37072fee85503c1ae5a7d8fae63253f91561ec07 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 25 May 2020 13:49:29 +0200 Subject: [PATCH 1/4] [polybar] Add minimum priority to due items Items displayed for being due are at least requiring a level 3 priority (i.e. the lowest; any priority at all). Items without priority will not be counted by polybar. --- polybar/.config/polybar/config | 5 ++++- polybar/.config/polybar/scripts/poly-papersdue | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index 5175fac..07e331d 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -212,6 +212,7 @@ time-alt = %H:%M label = %date% %{T2} %{T-}%time% ; 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] type = custom/script exec = $XDG_CONFIG_HOME/polybar/scripts/poly-mprisdisplay @@ -219,7 +220,6 @@ exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-mprisdisplay tail = true click-left = kill -USR1 %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 [module/papersdue] @@ -227,7 +227,10 @@ type = custom/script exec = $XDG_CONFIG_HOME/polybar/scripts/poly-papersdue exec-if = type bib-due 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) +; 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-prefix = " " interval = 120 diff --git a/polybar/.config/polybar/scripts/poly-papersdue b/polybar/.config/polybar/scripts/poly-papersdue index e1cbc85..7eb1084 100755 --- a/polybar/.config/polybar/scripts/poly-papersdue +++ b/polybar/.config/polybar/scripts/poly-papersdue @@ -1,7 +1,7 @@ #!/usr/bin/env sh 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)" # add polybar formatting to color required readings red From e513a77bc196ee97627722be64a1e206219af919 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 25 May 2020 14:06:15 +0200 Subject: [PATCH 2/4] [polybar] Add pomo timer as git submodule Using [jsspencer/pomo](https://github.com/jsspencer/pomo) as the timer of choice. It is simple, it works well, and it uses a very elegant way of tracking the time. I can think about implementing my own version later, but this will handily suffice for now. --- .gitmodules | 3 +++ polybar/.local/share/pomo | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 polybar/.local/share/pomo diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bb95830 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "polybar/.local/share/pomo"] + path = polybar/.local/share/pomo + url = https://github.com/jsspencer/pomo.git diff --git a/polybar/.local/share/pomo b/polybar/.local/share/pomo new file mode 160000 index 0000000..68a8e26 --- /dev/null +++ b/polybar/.local/share/pomo @@ -0,0 +1 @@ +Subproject commit 68a8e26a46f8516ee73b429c153a1fc7a4a2c300 From 657ef21b0bfe550218bfe112b4eefc620495c26a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 25 May 2020 15:00:36 +0200 Subject: [PATCH 3/4] [polybar] Fix pomo timer notification updating Fixed notifications following outdated pomo timers if the timer was ever paused or restarted. Will now limit the pomo timer to a single 'running' instance containing the notification function. --- polybar/.config/polybar/config | 13 ++++++++- polybar/.config/polybar/scripts/poly-pomo | 35 +++++++++++++++++++++++ polybar/.local/bin/pomo | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 polybar/.config/polybar/scripts/poly-pomo create mode 120000 polybar/.local/bin/pomo diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index 07e331d..5fdeaa0 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -57,7 +57,7 @@ padding-left = 0 padding-right = 0 module-margin-left = 2 -modules-left = workspaces +modules-left = workspaces pomo modules-center = music date papersdue modules-right = networkspeed archupdates cpu temp backlight volume battery ; do not use offsets for the bar, would only work with override-redirect @@ -235,6 +235,17 @@ click-right = exist rofi-bib-due normal "opening due papers" && rofi-bib-due -p3 format-prefix = " " 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 ; uses pacman-contrib/checkupdates if available to avoid partial arch upgrades [module/archupdates] diff --git a/polybar/.config/polybar/scripts/poly-pomo b/polybar/.config/polybar/scripts/poly-pomo new file mode 100755 index 0000000..9616b16 --- /dev/null +++ b/polybar/.config/polybar/scripts/poly-pomo @@ -0,0 +1,35 @@ +#!/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 + pomo clock + sleep 1 + done +elif [ "$1" = "toggle" ]; then + pomo pause + restart_notify +elif [ "$1" = "restart" ]; then + pomo stop && pomo start + restart_notify +fi diff --git a/polybar/.local/bin/pomo b/polybar/.local/bin/pomo new file mode 120000 index 0000000..c4dec47 --- /dev/null +++ b/polybar/.local/bin/pomo @@ -0,0 +1 @@ +../share/pomo/pomo.sh \ No newline at end of file From 2d78271113a94a8cdb15ee00e3be5a57bb55c288 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 25 May 2020 15:41:15 +0200 Subject: [PATCH 4/4] [polybar] Add icons to pomo timer Added running and paused tomato icons; as well as break coffee icon. Removed display of seconds, unless the last minute of a timer is running. --- polybar/.config/polybar/scripts/poly-pomo | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/polybar/.config/polybar/scripts/poly-pomo b/polybar/.config/polybar/scripts/poly-pomo index 9616b16..ccef2f4 100755 --- a/polybar/.config/polybar/scripts/poly-pomo +++ b/polybar/.config/polybar/scripts/poly-pomo @@ -23,7 +23,13 @@ restart_notify() { if [ -z "$1" ]; then run_notify while true; do - pomo clock + 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