1 files changed,
38 insertions(+),
0 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2025-09-09 23:31:10 +0300
Parent:
1789289
A
bin/time.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash +set -euo pipefail + +CATEGORIES=( + "stop" + "programming" + "notes" + "chat" + "chore" + "study" + "wasted" +) + +_stop() { timew stop; } + +_status() { + if current=$(timew get dom.active.tags 2>/dev/null); then + echo "$current" + else + echo "none" + fi +} + +_select() { + selected=$(printf "%s\n" "${CATEGORIES[@]}" | sk --margin 25% --color="bw" --reverse) + [[ "$selected" == "" ]] && exit 1 + + if [[ "$selected" == "stop" ]] + then _stop + else timew start "$selected" + fi +} + +case "${1:-}" in + status) _status ;; + stop) _stop ;; + *) _select ;; +esac