39 lines
1.1 KiB
Bash
Executable File
39 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
source ~/scripts/constantlib.sh
|
|
|
|
# Archivo donde se guarda el estado del timer
|
|
STATE_FILE="/tmp/waybar_timer"
|
|
OPCIONES="1\n5\n10\n20\n30\n60"
|
|
LABEL="⏲️ Timer (min):"
|
|
|
|
# Pedimos minutos con dmenu
|
|
minutes=$(echo -e $OPCIONES | rofi -dmenu -p "$LABEL" )
|
|
|
|
# Validamos si es un número
|
|
if ! [[ "$minutes" =~ ^[0-9]+$ ]]; then
|
|
exit 1
|
|
fi
|
|
|
|
# Convertimos a segundos
|
|
total_seconds=$((minutes * 60))
|
|
end_time=$(( $(date +%s) + total_seconds ))
|
|
|
|
# Guardamos el tiempo de finalización
|
|
echo "$end_time" > "$STATE_FILE"
|
|
|
|
# Ejecutamos el timer en segundo plano
|
|
(
|
|
while [ $(date +%s) -lt "$end_time" ]; do
|
|
sleep 1
|
|
done
|
|
notify-send -t 2000 -i /home/arthur/scripts/pngegg.png " Timer terminado" "se acabo' el tiempo"
|
|
notify-send -t 2000 -i /home/arthur/scripts/pngegg.png " Timer terminado" "se acabo' el tiempo"
|
|
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
|
|
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
|
|
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
|
|
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
|
|
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
|
|
rm -f "$STATE_FILE"
|
|
) &
|
|
|