Last active
December 27, 2023 15:53
-
-
Save jameswpm/2833c89b18fc3f571985779cbee0a2b8 to your computer and use it in GitHub Desktop.
Minimalistic Pomodoro Timer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Minimalistic_Pomodoro_Timer | |
# | |
# Based on the SU answer found here: https://superuser.com/questions/224265/pomodoro-timer-for-linux/669811#669811 | |
# | |
# Tested in Ubuntu 16.04 and Arch | |
pomodorotime () { | |
notify-send "Time to Work" "Focus" -u normal -a 'Pomodoro' -i $HOME/Documentos/icon.png | |
paplay /usr/share/sounds/freedesktop/stereo/window-attention.oga | |
} | |
shortbreaktime () { | |
notify-send "Short Break Time" -u critical -a 'Pomodoro' -i $HOME/Documentos/icon.png | |
paplay /usr/share/sounds/freedesktop/stereo/complete.oga | |
# uncomment line below to lock your screen during the short break (needs to install xtrlock for your distribution) | |
# sleep 5 && xtrlock -b & sleep 250 && pkill xtrlock | |
} | |
longbreaktime () { | |
notify-send "Long Break Time" "Take a Rest" -u critical -a 'Pomodoro' -i $HOME/Documentos/icon.png | |
paplay /usr/share/sounds/freedesktop/stereo/complete.oga | |
} | |
case "$1" in | |
'start') | |
echo "Starting Pomodoro" | |
counter=0 | |
while true; do | |
now=`date +"%H:%M"` | |
pomodorotime | |
counter=$((counter+1)) | |
echo "Pomodoro number: $counter started at: $now" | |
sleep 1500 && shortbreaktime | |
sleep 300 && pomodorotime | |
now=`date +"%H:%M"` | |
counter=$((counter+1)) | |
echo "Pomodoro number: $counter started at: $now" | |
sleep 1500 && shortbreaktime | |
sleep 300 && pomodorotime | |
now=`date +"%H:%M"` | |
counter=$((counter+1)) | |
echo "Pomodoro number: $counter started at: $now" | |
sleep 1500 && shortbreaktime | |
sleep 300 && pomodorotime | |
now=`date +"%H:%M"` | |
counter=$((counter+1)) | |
echo "Pomodoro number: $counter started at: $now" | |
sleep 1500 && longbreaktime | |
echo "Long break time" | |
sleep 900 | |
done | |
;; | |
'pomo') | |
pomodorotime | |
sleep 1500 && shortbreaktime | |
;; | |
'sb') | |
sleep 300 && pomodorotime | |
;; | |
'lb') | |
sleep 900 && pomodorotime | |
;; | |
*) | |
echo | |
echo "Usage: $0 { start | pomo | sb | lb }" | |
echo | |
exit 1 | |
;; | |
esac | |
exit 0 |
Yes, this is really what I asked. Thank you very much.
I am very ashamed!
man
info
--help
I had to first check all these options. From now on I will try to prevent this.
This lesson was much more useful than what I learned the meaning of the -a
option.
Once again, I apologize for my ignorance.
Hi, thank you for this script.
I want to use it maybe modify it a little bit.
What is the license for that script.
Hey, @marc31
I didn't include any license for it because it's just a toy project, so "Do What the Fuck You Want To" ;-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right, I got your question now. @alexeygorelov
The -a option it's just used to define a name for the icon of the running "application". I really don't know why it isn't in the man page, but you can see it with the command
notify-send --help
. The result is something like below:Actually, I think that doesn't make any difference, so you can ignore it. Hope that it answer your question.