Skip to content

Commit

Permalink
Basic pomodoro timer
Browse files Browse the repository at this point in the history
  • Loading branch information
NonlinearFruit committed Jul 9, 2024
1 parent 0e84c83 commit be61450
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The actual dotfiles for various tools
|nvim|
|termux|
|tmux|
|todo|
|vimrc|
|vivaldi|
|wezterm|
Expand All @@ -56,6 +57,7 @@ Helpful automation for various tasks
|Script|
|-|
|backup-repo|
|chat|
|checkup|
|clip|
|countdown|
Expand All @@ -71,6 +73,7 @@ Helpful automation for various tasks
|number-gossip|
|nvims|
|passphrase|
|pomodoro|
|precisionvim|
|rusty-link|
|ssh|
Expand Down
56 changes: 56 additions & 0 deletions scripts/pomodoro
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env nu

# Start and view status of tomato timers
def main [
-t
-l
-b
-s
] {
if $t {
start-tomato
} else if $b {
start-short-break
} else if $l {
start-long-break
}
if $s {
time-left
}
}

def start-tomato [] {
(date now) + 25min
| save -f (filepath)
}

def start-short-break [] {
(date now) + 5min
| save -f (filepath)
}

def start-long-break [] {
(date now) + 15min
| save -f (filepath)
}

def time-left [] {
open (filepath)
| into datetime
| $in - (date now)
| if $in < 0min {
"Done"
} else {
format duration min
}
}

def filepath [] {
"~/.pomodoro"
| path expand
}

def error [msg] {
print $"(ansi red)($msg)(ansi reset)"
exit 1
}
5 changes: 5 additions & 0 deletions toolkit.nu
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def get-configs [] {
| where stem not-in $not_configs
| get stem
| uniq
| sort
}

def get-scripts [] {
Expand All @@ -161,25 +162,29 @@ def get-scripts [] {
| path parse
| where ($it.extension | is-empty)
| get stem
| sort
}

def get-mappings [] {
ls mappings
| get name
| path parse
| get stem
| sort
}

def get-setups [] {
ls setups
| get name
| path parse
| get stem
| sort
}

def get-cheatsheets [] {
ls cheatsheets
| get name
| path parse
| get stem
| sort
}

0 comments on commit be61450

Please sign in to comment.