benj's blog

The blog with REAL pieces of geek inside!

Avril 2005
Dim Lun Mar Mer Jeu Ven Sam
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Mar  Mai
Tuning EMMS

Mercredi, 27 Avril 2005

In a previous blog entry, I talked about EMMS, a cool OGG player for Emacs based on ogg123.

Unfortunately, it missed some features I need : easy shortcuts and above all, a "pause" feature. You know, the one that is needed when your boss want to talk to you just during that crazy guitar solo.

So here is what I added in my Emacs config file:

(global-set-key "C-xwf" 'emms-next)
(global-set-key "C-xwb" 'emms-previous)
(global-set-key "C-xwq" 'emms-stop)
(global-set-key "C-xws" 'emms-start)
(global-set-key "C-xwp" 'my-pause)
(defun my-pause ()
  (interactive)
  (start-process "pause-ogg123" nil "pause-ogg123"))

pause-ogg123 being a simple shell script that I've hacked because I was too lazy to do that in elisp:

#!/bin/sh
if ps auxw | grep ogg123 | awk '{print $8}'| grep -q ^T ; then
    killall -CONT ogg123
else
    killall -STOP ogg123
fi

If someone has a more elegant solution than sending signals to ogg123, I'd gladly accept any patch. :-)