From b3d5d698dd72c099080f20759de76999087ee86c Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Sun, 26 May 2024 12:53:18 +0200 Subject: add pomodoro --- mut/bin/sb-pomodoro | 35 +++++++++++++++++++++++++++++++++++ mut/dwmblocks | 2 +- mut/neovim/fnl/conf/lsp.fnl | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100755 mut/bin/sb-pomodoro (limited to 'mut') diff --git a/mut/bin/sb-pomodoro b/mut/bin/sb-pomodoro new file mode 100755 index 0000000..b4f79f3 --- /dev/null +++ b/mut/bin/sb-pomodoro @@ -0,0 +1,35 @@ +#!/bin/sh + +# Displays current pomodoro status +# When clicked, brings up `newsboat`. + +case $BLOCK_BUTTON in + 1) setsid -f pomodoro start >/dev/null ;; + 2) setsid -f pomodoro finish >/dev/null ;; + 3) notify-send "🍅 Pomodoro module" "\- Shows current pomodoro status +- Shows ⏱ if a Pomodoro is running +- Left click starts a new Pomodoro +- Middle click finishes a Pomodoro early +- Shift click opens ~/.pomodoro in editor" ;; + 6) "$TERMINAL" -e "$EDITOR" "$HOME/.pomodoro" ;; +esac + +if ! status=$(pomodoro status); then + exit 0 +fi + +if [ -z "$status" ]; then + daily_completed=$(grep -c "^$(date --iso-8601)" ~/.pomodoro/history) + daily_total="$(grep daily_goal ~/.pomodoro/settings | cut -f2 -d'=')" + + msg="$daily_completed/$daily_total🍅" + if [ "$daily_completed" -ne "0" ]; then + seconds_since_last_started="$(( $(date +%s -u) - $(tail -n1 ~/.pomodoro/history | cut -f1 -d' ' | xargs -I{} date -d"{}" +%s -u) ))" + seconds_since_last="$(( "$seconds_since_last_started" - 60*$(tail -n1 ~/.pomodoro/history | cut -f2 -d' ' | cut -f2 -d'=')))" + msg="$(date -d@"$seconds_since_last" +"%H:%M" -u)min ago $msg" + fi + echo "$msg" + exit 0 +fi + +echo "$status" diff --git a/mut/dwmblocks b/mut/dwmblocks index 4d79273..f84c9c8 160000 --- a/mut/dwmblocks +++ b/mut/dwmblocks @@ -1 +1 @@ -Subproject commit 4d792732191817ced096f6f89559e1bcfd204032 +Subproject commit f84c9c8f36f29c4380ff7edecff91f841446c1be diff --git a/mut/neovim/fnl/conf/lsp.fnl b/mut/neovim/fnl/conf/lsp.fnl index 12cbc99..3982fe6 100644 --- a/mut/neovim/fnl/conf/lsp.fnl +++ b/mut/neovim/fnl/conf/lsp.fnl @@ -22,7 +22,7 @@ :codeLensProvider (bm :n :gl #(vim.lsp.codelens.run)) :hoverProvider (bo :keywordprg ":LspHover") :inlayHintProvider (do - (vim.lsp.inlay_hint.enable buf true) + (vim.lsp.inlay_hint.enable true) (bm :n :gh #(vim.lsp.inlay_hint.enable 0 (not (vim.lsp.inlay_hint.is_enabled 0))))) :documentFormattingProvider (do (bo :formatexpr -- cgit v1.2.3