src/clfswm-util.lisp (cut-current-child, remove-current-child, delete-current-child...
[clfswm.git] / contrib / mpd.lisp
blob5bf9ba2297adf0f674496fdbad60ef946df3f009
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: If you want to use this file, just add this line in
25 ;;; your configuration file:
26 ;;;
27 ;;; (load-contrib "mpd.lisp")
28 ;;;
29 ;;; --------------------------------------------------------------------------
31 (in-package :clfswm)
33 (format t "Loading MPD code... ")
36 (defun mpd-menu ()
37 "Open the Music Player Daemon (MPD) menu"
38 (open-menu (find-menu 'mpd-menu)))
41 (defun start-sonata ()
42 "Start sonata"
43 (do-shell "exec sonata"))
45 (defun start-gmpc ()
46 "Start gmpc"
47 (do-shell "exec gmpc"))
50 (defun show-mpd-info ()
51 "Show MPD informations"
52 (info-on-shell "MPD informations:" "mpc")
53 (mpd-menu))
55 (defun mpd-previous ()
56 "Play the previous song in the current playlist"
57 (info-on-shell "MPD:" "mpc prev")
58 (mpd-menu))
60 (defun mpd-next ()
61 "Play the next song in the current playlist"
62 (info-on-shell "MPD:" "mpc next")
63 (mpd-menu))
65 (defun mpd-toggle ()
66 "Toggles Play/Pause, plays if stopped"
67 (do-shell "mpc toggle"))
69 (defun mpd-play ()
70 "Start playing"
71 (do-shell "mpc play"))
73 (defun mpd-stop ()
74 "Stop the currently playing playlists"
75 (do-shell "mpc stop"))
78 (defun mpd-seek-+5% ()
79 "Seeks to +5%"
80 (do-shell "mpc seek +5%")
81 (mpd-menu))
83 (defun mpd-seek--5% ()
84 "Seeks to -5%"
85 (do-shell "mpc seek -5%")
86 (mpd-menu))
88 (defun show-mpd-playlist ()
89 "Show the current MPD playlist"
90 (info-on-shell "Current MPD playlist:" "mpc playlist")
91 (mpd-menu))
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)
116 (format t "done~%")