1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: Music Player Daemon (MPD) interface
6 ;;; --------------------------------------------------------------------------
8 ;;; (C) 2009 Philippe Brochard <hocwp@free.fr>
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.
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.
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.
24 ;;; Documentation: If you want to use this file, just add this line in
25 ;;; your configuration file:
27 ;;; (load-contrib "mpd.lisp")
29 ;;; --------------------------------------------------------------------------
33 (format t
"Loading MPD code... ")
37 "Open the Music Player Daemon (MPD) menu"
38 (open-menu (find-menu 'mpd-menu
)))
41 (defun start-sonata ()
43 (do-shell "exec sonata"))
47 (do-shell "exec gmpc"))
50 (defun show-mpd-info ()
51 "Show MPD informations"
52 (info-on-shell "MPD informations:" "mpc")
55 (defun mpd-previous ()
56 "Play the previous song in the current playlist"
57 (info-on-shell "MPD:" "mpc prev")
61 "Play the next song in the current playlist"
62 (info-on-shell "MPD:" "mpc next")
66 "Toggles Play/Pause, plays if stopped"
67 (do-shell "mpc toggle"))
71 (do-shell "mpc play"))
74 "Stop the currently playing playlists"
75 (do-shell "mpc stop"))
78 (defun mpd-seek-+5%
()
80 (do-shell "mpc seek +5%")
83 (defun mpd-seek--5%
()
85 (do-shell "mpc seek -5%")
88 (defun show-mpd-playlist ()
89 "Show the current MPD playlist"
90 (info-on-shell "Current MPD playlist:" "mpc playlist")
93 (unless (find-menu 'mpd-menu
)
94 (add-sub-menu 'help-menu
"F2" 'mpd-menu
"Music Player Daemon (MPD) menu")
96 (add-menu-key 'mpd-menu
"i" 'show-mpd-info
)
97 (add-menu-key 'mpd-menu
"p" 'mpd-previous
)
98 (add-menu-key 'mpd-menu
"n" 'mpd-next
)
99 (add-menu-key 'mpd-menu
"t" 'mpd-toggle
)
100 (add-menu-key 'mpd-menu
"y" 'mpd-play
)
101 (add-menu-key 'mpd-menu
"k" 'mpd-stop
)
102 (add-menu-key 'mpd-menu
"x" 'mpd-seek-
+5%
)
103 (add-menu-key 'mpd-menu
"w" 'mpd-seek--5%
)
104 (add-menu-key 'mpd-menu
"l" 'show-mpd-playlist
)
105 (add-menu-key 'mpd-menu
"s" 'start-sonata
)
106 (add-menu-key 'mpd-menu
"g" 'start-gmpc
))
109 (defun mpd-binding ()
110 (define-main-key ("F2" :alt
) 'mpd-menu
))
112 (add-hook *binding-hook
* 'mpd-binding
)