-
-
Save bashbunni/f6b04fc4703903a71ce9f70c58345106 to your computer and use it in GitHub Desktop.
# I'll be doing another one for Linux, but this one will give you | |
# a pop up notification and sound alert (using the built-in sounds for macOS) | |
# Requires https://github.com/caarlos0/timer to be installed | |
# Mac setup for pomo | |
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\ | |
-title 'Work Timer is up! Take a Break π'\ | |
-appIcon '~/Pictures/pumpkin.png'\ | |
-sound Crystal" | |
alias rest="timer 10m && terminal-notifier -message 'Pomodoro'\ | |
-title 'Break is over! Get back to work π¬'\ | |
-appIcon '~/Pictures/pumpkin.png'\ | |
-sound Crystal" |
You don't need to install
terminal-notifier
if you don't want to. You can trigger notifications on osx with applescriptosascript -e 'display notification "β" with title "Work Timer is up!" subtitle "Take a Break π" sound name "Crystal"'
but how would i combine this with the alias, cause then there are 3 layers of strings?
You don't need to install
terminal-notifier
if you don't want to. You can trigger notifications on osx with applescriptosascript -e 'display notification "β" with title "Work Timer is up!" subtitle "Take a Break π" sound name "Crystal"'
but how would i combine this with the alias, cause then there are 3 layers of strings?
ok you would have to escape it like this: " -> so in the rc-file it would look like this:
alias work="timer 50m && osascript -e 'display notification \"β\" with title \"Work Timer is up!\" subtitle \"Take a Break π\" sound name \"Crystal\"'"
i've been playing around and attempting to add a time input, but it doesnt recognize an argument. I've looked over my other alias and have no issues with adding an argument.
alias work="timer $1 && osascript -e 'display notification \"β\" with title \"Work Timer is up!\" subtitle \"Take a Break π\" sound name \"Crystal\"' && say \"Phase complete\""
i've been playing around and attempting to add a time input, but it doesnt recognize an argument. I've looked over my other alias and have no issues with adding an argument.
alias work="timer $1 && osascript -e 'display notification \"β\" with title \"Work Timer is up!\" subtitle \"Take a Break π\" sound name \"Crystal\"' && say \"Phase complete\""
alias work='work_alias(){ timer "$1" && osascript -e "display notification \"β\" with title \"Work Timer is up!\" subtitle \"Take a Break π\" sound name \"Crystal\"" && say "Phase complete"; unset -f work_alias; }; work_alias'
this works for me
Super helpful, thanks for posting this.
If it's helpful to anyone, I edited the alias to instead run as a bash script so we can turn on/off focus mode easily, including turning it off when exiting the program early. I also added a time arg but it defaults to whatever you time you write in the script (25m and 5m below):