Fixe a double gcontext free
[clfswm.git] / contrib / xmms.lisp
blob3921b898f634acd700249aacea9b749d3aa598cb
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Music Player Daemon (MPD) interface
6 ;;; --------------------------------------------------------------------------
7 ;;;
8 ;;; (C) 2009 Philippe Brochard <hocwp@free.fr>
9 ;;;
10 ;;; This program is free software; you can redistribute it and/or modify
11 ;;; it under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or
13 ;;; (at your option) any later version.
14 ;;;
15 ;;; This program is distributed in the hope that it will be useful,
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with this program; if not, write to the Free Software
22 ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 ;;;
24 ;;; Documentation: Handle the XMMS player
25 ;;; This code needs xmmsctrl.
26 ;; If you want to use this file, just add this line in
27 ;;; your configuration file:
28 ;;;
29 ;;; (load-contrib "xmms.lisp")
30 ;;;
31 ;;; --------------------------------------------------------------------------
33 (in-package :clfswm)
35 (format t "Loading XMMS code... ")
37 (defun xmms-menu ()
38 "Open the XMMS menu"
39 (open-menu (find-menu 'xmms-menu)))
41 (defun launch-xmms ()
42 "Lanch XMMS"
43 (do-shell "xmmsctrl launch"))
45 (defun show-xmms-status ()
46 "Show the current xmms status"
47 (info-on-shell "XMMS status:" "xmmsctrl cur"))
49 (defun show-xmms-playlist ()
50 "Show the current xmms playlist"
51 (info-on-shell "XMMS Playlist:" "xmmsctrl playlist"))
53 (defun xmms-next-track ()
54 "Play the next XMMS track"
55 (do-shell "xmmsctrl next")
56 (show-xmms-status)
57 (xmms-menu))
59 (defun xmms-previous-track ()
60 "Play the previous XMMS track"
61 (do-shell "xmmsctrl previous")
62 (show-xmms-status)
63 (xmms-menu))
65 (defun xmms-load-file ()
66 "open xmms \"Load file(s)\" dialog window."
67 (do-shell "xmmsctrl eject"))
69 (unless (find-menu 'xmms-menu)
70 (add-sub-menu 'help-menu "x" 'xmms-menu "XMMS menu")
72 (add-menu-key 'xmms-menu "r" 'launch-xmms)
73 (add-menu-key 'xmms-menu "s" 'show-xmms-status)
74 (add-menu-key 'xmms-menu "l" 'show-xmms-playlist)
75 (add-menu-key 'xmms-menu "n" 'xmms-next-track)
76 (add-menu-key 'xmms-menu "p" 'xmms-previous-track)
77 (add-menu-key 'xmms-menu "e" 'xmms-load-file))
79 (format t "done~%")