mini_timer

· lachesis's pastes · raw

expires: 2026-08-03

 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	paplay ~/dotfiles/misc/sounds/chime
21	spd-say -t female3 -r +25 "timer done!"
22}
23
24# make styling easier
25gum_border() {
26	gum style --foreground "#a6d189" --border-foreground "#99d1db" --border double --width 50 --padding "0 0" --align center "$@"
27}
28
29gum_echo() {
30	gum style --foreground "#f4b8e4" --width 50 --padding "0 0" --align center "🌈✩₊˚.⋆⋆⁺₊✧ $* ✩₊˚.⋆⋆⁺₊✧🦋" && echo -e "\n"
31}
32
33# do everything
34if [[ ! "$time" =~ "m" ]]; then
35	echo "add a time or a time unit (m for minutes)"
36else
37	gum_border "♥ mini timer ♥"
38	gum_echo "$time"
39	timer -n "mini timer" "$time" && notif || exit 1
40fi