main dots / config / .local / bin / mini_timer
xxwhirlpool  ·  2026-09-17
 1#!/usr/bin/env bash
 2
 3# check for deps (messily)
 4if [[ ! "$(command -v timer)" ]]; then
 5	echo "missing required dependency: timer"
 6	echo "github.com/caarlos0/timer"
 7	exit 1
 8elif [[ ! "$(command -v gum)" ]]; then
 9	echo "missing required dependency: gum"
10	echo "github.com/charmbracelet/gum"
11	exit 1
12fi
13
14# vars
15time="$1"
16
17# notif
18notif() {
19	notify-send "timer done!"
20	sfx chime
21}
22
23# make styling easier
24gum_border() {
25	gum style --foreground "#a6d189" --border-foreground "#99d1db" --border double --width 50 --padding "0 0" --align center "$@"
26}
27
28gum_echo_custom() {
29	gum style --foreground "#f4b8e4" --width 50 --padding "0 0" --align center "🌈✩₊˚.⋆⋆⁺₊✧ $* ✩₊˚.⋆⋆⁺₊✧🦋" && echo -e "\n"
30}
31
32# do everything
33if [[ ! "$time" =~ "m" ]]; then
34	echo "add a time or a time unit (m for minutes)"
35else
36	gum_border "♥ mini timer ♥"
37	gum_echo_custom "$time"
38	timer -n "mini timer" "$time" && notif || exit 1
39fi