diff options
| author | Mike Vink <mike@pionative.com> | 2024-05-26 12:53:18 +0200 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2024-05-26 12:53:18 +0200 |
| commit | b3d5d698dd72c099080f20759de76999087ee86c (patch) | |
| tree | f1df6b0531cd467de5bcded8f3b8ef1e4ffb8933 | |
| parent | 3af5fc5f86848924d49d30ecb8f5c2b960c9b1af (diff) | |
add pomodoro
| -rw-r--r-- | flake.nix | 1 | ||||
| -rwxr-xr-x | mut/bin/sb-pomodoro | 35 | ||||
| m--------- | mut/dwmblocks | 0 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/lsp.fnl | 2 | ||||
| -rw-r--r-- | overlays/openpomodoro-cli.nix | 19 | ||||
| -rw-r--r-- | profiles/core/configuration.nix | 1 | ||||
| -rw-r--r-- | profiles/station/suckless.nix | 1 |
7 files changed, 58 insertions, 1 deletions
@@ -49,6 +49,7 @@ nixpkgs.overlays = with lib; [ (composeManyExtensions [ (import ./overlays/vimPlugins.nix {inherit pkgs;}) + (import ./overlays/openpomodoro-cli.nix {inherit pkgs lib;}) inputs.neovim-nightly-overlay.overlay ]) ]; 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 -Subproject 4d792732191817ced096f6f89559e1bcfd20403 +Subproject f84c9c8f36f29c4380ff7edecff91f841446c1b 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 :<leader>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 :<leader>gh #(vim.lsp.inlay_hint.enable 0 (not (vim.lsp.inlay_hint.is_enabled 0))))) :documentFormattingProvider (do (bo :formatexpr diff --git a/overlays/openpomodoro-cli.nix b/overlays/openpomodoro-cli.nix new file mode 100644 index 0000000..6443868 --- /dev/null +++ b/overlays/openpomodoro-cli.nix @@ -0,0 +1,19 @@ +{pkgs, lib, ...}: (final: prev: + with pkgs; { + openpomodoro-cli = buildGoModule rec { + pname = "openpomodoro-cli"; + version = "0.3.0"; + + src = fetchFromGitHub { + owner = "open-pomodoro"; + repo = "openpomodoro-cli"; + rev = "v${version}"; + hash = "sha256-h/o4yxrZ8ViHhN2JS0ZJMfvcJBPCsyZ9ZQw9OmKnOfY="; + }; + + + vendorHash = "sha256-BR9d/PMQ1ZUYWSDO5ID2bkTN+A+VbaLTlz5t0vbkO60="; + + }; + } +) diff --git a/profiles/core/configuration.nix b/profiles/core/configuration.nix index bfebed3..0d322bb 100644 --- a/profiles/core/configuration.nix +++ b/profiles/core/configuration.nix @@ -69,6 +69,7 @@ bc mediainfo bat + openpomodoro-cli ] ++ (optionals (!machine.isDarwin) [ pkgsi686Linux.glibc gdb diff --git a/profiles/station/suckless.nix b/profiles/station/suckless.nix index aa4c15f..33949c1 100644 --- a/profiles/station/suckless.nix +++ b/profiles/station/suckless.nix @@ -73,6 +73,7 @@ }; home.packages = with pkgs; [ libnotify + sxiv st dwm dwmblocks |
