Created
April 7, 2021 22:47
-
-
Save emmanuelrosa/1f913b267d03df9826c36202cf8b1c4e to your computer and use it in GitHub Desktop.
A custom rofi mode which provides 20 and 5 minute timers.
This file contains 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
#! /run/current-system/sw/bin/env bash | |
# POMODORO: A custom rofi mode which provides 20 and 5 minute timers. | |
# USAGE: rofi -combi-modi window,drun,pomo -show combi -modi combi,pomo:$HOME/bin/pomodoro | |
OPT_START_TASK="20 minute timer" | |
OPT_START_BREAK="5 minute timer" | |
SLEEP_TASK=1200 | |
SLEEP_BREAK=300 | |
# Sounds effects from soundbible.com | |
TIMER_START_AUDIO="$HOME/Media/sounds/sms-alert-1-daniel_simon.wav" | |
TIMER_STOP_AUDIO="$HOME/Media/sounds/service-bell_daniel_simion.wav" | |
function execTimer { | |
systemd-run --user paplay $TIMER_START_AUDIO && systemd-run --user --on-active=$1 paplay $TIMER_STOP_AUDIO | |
} | |
function startTimer { | |
case "$1" in | |
"$OPT_START_TASK") execTimer $SLEEP_TASK;; | |
"$OPT_START_BREAK") execTimer $SLEEP_BREAK;; | |
esac | |
} | |
if [ "$@" ] | |
then | |
startTimer "$@" | |
else | |
echo -e "$OPT_START_TASK\n$OPT_START_BREAK" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment