Skip to content
LeoUfimtsev edited this page Feb 18, 2015 · 8 revisions

Break time and pomodoro time progress timer on Linux

You can add hooks to org-pomodoro to run external processes. This can be used to run external progress bars if you wish.

Add the following to your .emacs:

(add-hook 'org-pomodoro-finished-hook
  (lambda ()
    (interactive)
    (call-process "yadKill")
    (start-process-shell-command "yad Break timers command" nil "yadBreakTime")
    ))  
(add-hook 'org-pomodoro-started-hook
  (lambda ()
    (interactive)  
    ;Kill of old break timer window if it exist.
    (call-process "yadKill")
    (start-process-shell-command "yad Break timers command" nil "yadBottomProgressBar")
    ))   

Now create three bash scripts and place them into your path:

yadBottomProgressBar

xpixels=$(xrandr --current | grep "Screen" | cut -d ',' -f2 | cut -d ' ' -f3) #grab total x of combined monitors.
xposOfYad=$(expr $xpixels  / 2 - 154)  #place in the middle of total space.
ypixels=$(xrandr --current | grep "Screen" | cut -d ',' -f2 | cut -d ' ' -f5)
yPosOfYad=$(expr $ypixels + 10)
echo $xposOfYad " " $yPosOfYad
yad --on-top --sticky --info --text="$*" --timeout=1500 --timeout-indicator=top --text-align=center --no-buttons --center --undecorated --geometry=50x5+$xposOfYad+$yPosOfYad

yadBreakTime

 #!/bin/sh 
xpixels=$(xrandr --current | grep "Screen" | cut -d ',' -f2 | cut -d ' ' -f3) #grab total x of combined monitors.
xposOfYad=$(expr $xpixels  / 2 - 400)  #place in the middle of total space.
yad --on-top --sticky --info --text="$*" --timeout=300 --timeout-indicator=bottom --text-align=center --no-buttons --center --undecorated --geometry=800x50+$xposOfYad+-5

yadKill

pkill yad

Now it'll open progress bars for when a pomodoro starts. the yadKill is useful if you start a pomodoro before finishing a break. The break/progress bars can be closed by pressing escape on them.
For positioning, see the --geometry property and man pages. also inspect the xrandr output to customize to your needs.

Activating emacs
You may find that yad steals focus. In that case you can append some lines in the yad script to re-activate emacs with xdotool

sleep 0.1
xdotool search --onlyvisible --class emacs windowactivate
Clone this wiki locally