1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #!/bin/bash
audio="/home/anon/Musica/Clasica/Dvorak - New World Symphony (Full).mp3"
work_time=25;
rest_time=5;
long_rest_time=15;
long_rest_interval=5;
alarm() {
mplayer "$audio"
}
timer () {
time=$(( $1 * 60 ))
for i in $(seq 1 $time); do
total_seconds_remaining=$((time - i))
minutes_remaining=$((total_seconds_remaining / 60))
seconds_remaining=$((total_seconds_remaining % 60))
echo -ne " $minutes_remaining minutos $seconds_remaining segundos restantes...\r"
sleep 1s
done
}
display_title() {
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "| - P - O - M - O - D - O - R - O - |"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
}
display_session () {
notify-send "$1"
echo ""
echo " $1"
echo ""
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo ""
}
main () {
rest_counter=0;
long_rest_counter=0;
work_counter=0;
clear;
display_title
while true; do
((rest_counter++));
is_rest_time=$((rest_counter % 2))
if [ $is_rest_time -eq 0 ] ; then
((long_rest_counter++));
is_long_rest_time=$((long_rest_counter % long_rest_interval))
if [ $is_long_rest_time -eq 0 ] ; then
display_session "Sesión de descanso largo — 15 minutos"
timer $long_rest_time
alarm
else
display_session "Sesión de descanso corto — 5 minutos"
timer $rest_time
alarm
fi
else
display_session "Sesión de trabajo — 25 minutos"
((work_counter++));
timer $work_time;
alarm
fi
clear
total_work_minutes=$((work_counter * work_time))
work_hours=$((total_work_minutes / 60))
work_minutes=$((total_work_minutes % 60))
display_title
echo ""
echo -e " Sesiones de trabajo totales: $work_counter";
echo -e " Tiempo trabajado: $work_hours horas y $work_minutes minutos";
echo ""
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
done
}
main "$@"
# Copyright (C) 2025 HURSZ
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|