[Sawfish] yarock.jl

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


I don't know if many use YaRock as their media-player, but I've written a 
simple module that let's Sawfish control YaRock (play/pause, volume).

In case you're interessted, check the attached file.

Regards,
Chris
(define-structure yarock
  (export start-yarock
          stop-yarock
	  yarock-remote)

  (open rep
        rep.system
        rep.io.processes
        rep.io.timers
	rep.util.misc
        sawfish.wm.misc
        sawfish.wm.windows
        sawfish.wm.workspace)

  (define %yarock-proc nil)

  (define (start-yarock)
    "Start YaRock if not already running."
    (if (program-exists-p "YaRock")
        (progn
	  (when %yarock-proc (kill-process %yarock-proc))
          (setq %yarock-proc (make-process))
          (start-process %yarock-proc "YaRock"))
      (display-message (format nil "YaRock executable not found in PATH."))))

  (define (stop-yarock)
    "Stop YaRock, if running."
    (when %yarock-proc (kill-process %yarock-proc)))

  (define (yarock-remote action #!optional value)
    (case action
      ((play) (system "YaRock --play &"))
      ((play-pause) (system "YaRock --play-pause &"))
      ((pause) (system "YaRock --pause &"))
      ((stop) (system "YaRock --stop &"))
      ((prev) (system "YaRock --previous &"))
      ((next) (system "YaRock --next &"))
      ((volume) (system (format nil "YaRock --volume %s &") value))
      ((vol+) (system "YaRock --volume-up &"))
      ((vol-) (system "YaRock --voluem-down &"))
      ((seekto) (system (format nil "YaRock --seek-to %s &") value))
      ((seekby) (system (format nil "YaRock --seek-by %s &") value))
      ((append) (system (format nil "YaRock --append %s &") value))
      ((load) (system (format nil "YaRock --load %s &") value))
      ((nthtrack) (system (format nil "YaRock --play-track %s &") value))
      (t nil))))


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/