From 7ea4f8f5a358a972b441c8492ce56eb71ad2980b Mon Sep 17 00:00:00 2001 From: Tommaso Montefusco Date: Sun, 28 Oct 2018 22:30:16 +0100 Subject: [PATCH] Add pomodoro app script --- pomodoro | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 pomodoro diff --git a/pomodoro b/pomodoro new file mode 100755 index 0000000..3be3205 --- /dev/null +++ b/pomodoro @@ -0,0 +1,24 @@ +#!/bin/bash + +# A simple shell script to use as a pomodoro app. +# The first argument is the focus time length. +# The second argument is the break length. +# Made by Kiailandi (https://github.com/kiailandi) + +wseconds=${1:-25}*60; +pseconds=${2:-wseconds/300}*60; + +while true; do + date1=$((`date +%s` + $wseconds)); + while [ "$date1" -ge `date +%s` ]; do + echo -ne "$(date -u --date @$(($date1 - `date +%s` )) +%H:%M:%S)\r"; + done + notify-send "Break" "Time to walk and rest"; + read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'; + date2=$((`date +%s` + $pseconds)); + while [ "$date2" -ge `date +%s` ]; do + echo -ne "$(date -u --date @$(($date2 - `date +%s` )) +%H:%M:%S)\r"; + done + notify-send "Work" "Time to get back to work"; + read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'; +done