LoginSignup
11
10

More than 5 years have passed since last update.

bashでポモドーロタイマー作ったった

Last updated at Posted at 2014-08-29

背景

なが~い処理を流しててちょっとスキマ時間があったので作ってみた。
tmuxで時間とhtopをいつも画面下に出すようにしているんですが
もう2つ枠が余ってて、なにか入れたいなーと。

準備

macのbannerコマンドだと微妙だったので
figletをHomebrewからインストールしておく

$ brew install figlet

pomodoro.sh

pomodoro.sh
#!/bin/bash

clear
i=25
figlet ready?
read Wait
clear
figlet $((i))

while :
do
  sleep 1
  clear
  figlet $((i-=1))
  if [ $i -eq 0 ]
  then
    terminal-notifier -message "job finished"
    echo -n "Pomodoro[P],Short break[S], Long break[L]?> "
    read WAIT
    case "${WAIT:0:1}" in
      P | p )
        i=25
        ;;
      S | s)
        i=5
        ;;
      L | l)
        i=15
        ;;
      *)
        echo "Didn't match anything"
        echo "Pomodoro Start!"
        i=25
    esac
    clear
    figlet $((i))
  fi
done

こんなかんじです。
(添付のgifは1/60秒でお送りいたします)

pomo.gif

(ポップアップがうまくgifに入っていないけど)

11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
10