Remove L* keysym to use only F* (L1 become F11)
[clfswm.git] / contrib / cd-player.lisp
blobd017118e778c62f2bce097cb9922981a99c628af
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Music Player Daemon (MPD) interface
6 ;;; --------------------------------------------------------------------------
7 ;;;
8 ;;; (C) 2012 Philippe Brochard <pbrochard@common-lisp.net>
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 CD player
25 ;;; This code needs pcd (http://hocwp.free.fr/pcd.html).
26 ;; If you want to use this file, just add this line in
27 ;;; your configuration file:
28 ;;;
29 ;;; (load-contrib "cd-player.lisp")
30 ;;;
31 ;;; --------------------------------------------------------------------------
33 (in-package :clfswm)
35 (format t "Loading CDPLAYER code... ")
37 (defun cdplayer-menu ()
38 "Open the CDPLAYER menu"
39 (open-menu (find-menu 'cdplayer-menu)))
41 (defun cdplayer-play ()
42 "Start playing CD"
43 (do-shell "pcd play"))
45 (defun cdplayer-stop ()
46 "Stop playing CD"
47 (do-shell "pcd stop"))
49 (defun cdplayer-pause ()
50 "Toggle pause"
51 (do-shell "pcd toggle"))
53 (defun show-cdplayer-status ()
54 "Show the current CD status"
55 (info-on-shell "CDPLAYER status:" "pcd info")
56 (cdplayer-menu))
58 (defun show-cdplayer-playlist ()
59 "Show the current CD playlist"
60 (info-on-shell "CDPLAYER:" "pcd more_info")
61 (cdplayer-menu))
63 (defun cdplayer-next-track ()
64 "Play the next CD track"
65 (do-shell "pcd next")
66 (cdplayer-menu))
68 (defun cdplayer-previous-track ()
69 "Play the previous CD track"
70 (do-shell "pcd previous")
71 (cdplayer-menu))
73 (defun cdplayer-eject ()
74 "Eject CD"
75 (do-shell "pcd eject"))
77 (defun cdplayer-close ()
78 "Close CD"
79 (do-shell "pcd close"))
81 (unless (find-menu 'cdplayer-menu)
82 (add-sub-menu 'help-menu "i" 'cdplayer-menu "CDPLAYER menu")
84 (add-menu-key 'cdplayer-menu "y" 'cdplayer-play)
85 (add-menu-key 'cdplayer-menu "k" 'cdplayer-stop)
86 (add-menu-key 'cdplayer-menu "t" 'cdplayer-pause)
87 (add-menu-key 'cdplayer-menu "s" 'show-cdplayer-status)
88 (add-menu-key 'cdplayer-menu "l" 'show-cdplayer-playlist)
89 (add-menu-key 'cdplayer-menu "n" 'cdplayer-next-track)
90 (add-menu-key 'cdplayer-menu "p" 'cdplayer-previous-track)
91 (add-menu-key 'cdplayer-menu "e" 'cdplayer-eject)
92 (add-menu-key 'cdplayer-menu "c" 'cdplayer-close))
94 (format t "done~%")