File: Music

package info (click to toggle)
fvwm-crystal 3.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,748 kB
  • ctags: 793
  • sloc: sh: 2,815; cs: 880; python: 875; makefile: 212
file content (350 lines) | stat: -rw-r--r-- 11,582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# Support for audio players in Fvwm-Crystal:
# initialisations and some shared functions
# Written by: Dominique Michel <dominique_libre@users.sourceforge.net>
#
# This file must be included at the top of the music player control files.
#	Include components/functions/Music
#
# Some recipes do have a media button, the other do have a menu.
# Recipes with media button: Amiga, Corner, Default, Default with ACPI, Dock
# The bindings of the media buttons are:
#
#       n button        n button   fumction		    comment
#	Button 1:	(Mouse 1) Menu /Player 		# Main player menu
#			(Mouse 2) Music-GUI 		# show/hide the player
#			(Mouse 3) Music-QJackGUI 	# show/hide QJackCtl
#			(Mouse 4) Mixer-Volume-Up 	# main volume up
#			(Mouse 5) Mixer-Volume-Down 	# main volume down
#	Button 2:	(Mouse 1) Menu /Playlist-button # playlist menu
#			(Mouse 2) Menu /Music/Volume	# player volume menu
#			(Mouse 3) Menu /Mixer		# main mixer menu
#			(Mouse 4) Music-Next		# next media
#			(Mouse 5) Music-Prev		# previous media
#	Button 3:	(Mouse 1) Music-Play		# play
#			(Mouse 2) Music-Pause		# pause
#			(Mouse 3) Menu /Playback	# playback menu
#			(Mouse 4) Music-Speed-Up	# speed up
#			(Mouse 5) Music-Speed-Down	# speed down
#	Button 4:	(Mouse 1) Menu /Speed		# speed control menu
#			(Mouse 4) Music-Seek-+		# seek forward
#			(Mouse 5) Music-Seek--		# seek backward
# NOTE : the actual bindings are fixed into the recipes.
#
# Recipes with media menu: Clean, Clean Vertical, Light, Wing-Commander
# The media menu is: Popup /Music
#
# TODO : - Move the media button here
#	 - Find something to do with mouse 2 and 3 on button 4
#############################################################################

## Amixer and Mplayer are selected as default mixer and player if the user ##
##          didn't changed it. We keep them or the user settings.          ##

 ###########################################################################
# The playlists was previously in different player dependant places.
# They are now in 4 places:
# 	$[FVWM_USERDIR]/Playlists/Audio for the playlists of audio files
# 	$[FVWM_USERDIR]/Playlists/Video for the playlists of movie files
# 	$[HOME]/Playlists/Audio for "by the user managed" audio playlists
# 	$[HOME]/Playlists/Video for "by the user managed" video playlists
#
# 'Recreate the playlist' will manage the playlists in $[FVWM_USERDIR] in a
# very simple way: delete all and recreate all. At the same time, it will
# create the user managed directories if they don't exist.
#
# Note: according to /etc/xdg/user-dirs.defaults, the default medias paths
#	are $HOME/Music and $HOME/Videos and will be translated on a
#	per-path-element basis into the users locale.

# Mixer {{{1
Include components/functions/Mixer

# Variables {{{1
# playlists locations {{{2
InfoStoreAdd AudioPlaylists "$[FVWM_USERDIR]/Playlists/Audio"
InfoStoreAdd VideoPlaylists "$[FVWM_USERDIR]/Playlists/Video"
InfoStoreAdd UserManagedAudioPlaylists "$[HOME]/Playlists/Audio"
InfoStoreAdd UserManagedVideoPlaylists "$[HOME]/Playlists/Video"

# speed control (alsaplayer, mplayer) {{{2
InfoStoreRemove speed

# DVB channel lists (mplayer) {{{2
InfoStoreRemove MplayerChannelList1
InfoStoreRemove MplayerChannelList2
InfoStoreRemove MplayerChannelList3
InfoStoreRemove MplayerChannelList4

# Decimal point in use (alsaplayer) {{{2
InfoStoreRemove dec_point
PipeRead 'if [ $[infostore.MusicPlayer] = alsaplayer ]; then echo "InfoStoreAdd dec_point `locale decimal_point`"; fi'

# xmms2
InfoStoreRemove fvwm_audio_exec

# Styles for media players windows {{{1
Style Alsaplayer	NoActiveIconOverride, NoIcon, Sticky, WindowListSkip, StaysOnTop 
Style alsaplayer	UseStyle Alsaplayer

Style Audacious		StaysOnTop
Style Audacious		StartIconic, NoActiveIconOverride, NoIcon, !Title, Sticky, WindowListSkip
Style playlist		StartIconic, NoIcon, !Title, Sticky, WindowListSkip
Style equalizer		UseStyle playlist

Style beep-media-player !Title

# Cmus (NoIcon doesn't work -> ToDo: use FvwmIdent)
Style cmus		NoActiveIconOverride, NoIcon, Sticky, WindowListSkip, StaysOnTop
# Mocp (NoIcon doesn't work -> ToDo: use FvwmIdent)
Style mocp		NoActiveIconOverride, NoIcon, Sticky, WindowListSkip, StaysOnTop
Style MOC		UseStyle mocp

Style MPlayer		!Title, !Borders, GnomeIgnoreHints, EWMHIgnoreStackingOrderHints
Style "MPlayer - Video"	Title, Borders, GnomeIgnoreHints, EWMHIgnoreStackingOrderHints
Style XDRadio 		NoIcon, Sticky, WindowListSkip

Style quodlibet		StaysOnTop, NoIcon, Sticky, WindowListSkip

Style gxmms2		StaysOnTop, NoIcon, Sticky, WindowListSkip

Style qjackctl		NoActiveIconOverride, NoIcon, Sticky, WindowListSkip

# Functions {{{1
# menu /Player {{{2
# Recreate the playlists (all)
DestroyFunc Music-RecreatePlaylist
AddToFunc Music-RecreatePlaylist
+ I A $[FVWM_SYSTEMDIR]/scripts/make_all_playlists $[infostore.AudioPlaylists] $[infostore.VideoPlaylists] $[infostore.UserManagedAudioPlaylists] $[infostore.UserManagedVideoPlaylists]

# start the player(s) (alsaplayer, mplayer)
DestroyFunc Music-Start
DestroyMenu /Music/Start

# player quit (alsaplayer, mplayer)
DestroyFunc Music-Kill

# show/hyde the player GUI/menu (alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet)
DestroyFunc Music-GUI

# wrapper for cdcd
DestroyFunc Music-cdcd

# Second button {{{1
# Player controls and main vol 
# mouse 1 Menu /Playlist-button {{{2

# Remove playlist (all)
DestroyFunc Music-RemovePlaylist-generator
AddToFunc Music-RemovePlaylist-generator
+ I DestroyMenu recreate /Music/RemovePlaylist
+ I AddToMenu /Music/RemovePlaylist
+ I PipeRead 'for i in $[infostore.UserManagedAudioPlaylists]/*.{m3u,pls}; do \
  name=$(basename "$i"); \
  sname=${name%%.m3u}; \
  sname=${sname%%.pls}; \
  echo \"AddToMenu /Music/RemovePlaylist \'$sname\' Exec rm -f \'$i\'\"; done'

DestroyMenu /Music/RemovePlaylist
AddToMenu /Music/RemovePlaylist
+ DynamicPopupAction Function Music-RemovePlaylist-generator

# Copy playlist (all)
# Note: Visualy redundant; TODO: A recursive generator like in remove playlist
DestroyFunc FuncFvwmMenuCopyPlaylistDirectory
AddToFunc FuncFvwmMenuCopyPlaylistDirectory
+ I PipeRead 'case \"$0\" in \
	"$[infostore.AudioPlaylists]"*) myexec="Exec cp -r \'%f\' \'$[infostore.UserManagedAudioPlaylists]\'";; \
    esac; \
    test -f \"$0\"/.icontitle.png && mytitle=\"$0\"/.icontitle.png; \
    test -f \"$0\"/.media.png && mypng=\"$0\"/.media.png; \
    fvwm-menu-directory --icon-title "${mytitle:-22x22/categories/directory.png}" \
    --icon-file "${mypng:-22x22/categories/Audio.png}" \
    --dir \"$0\" --exec-title "-" --command-file "${myexec}" \
    --func-name "FuncFvwmMenuCopyPlaylistDirectory"'

DestroyMenu /Music/CopyPlaylist
AddToMenu /Music/CopyPlaylist
#+ '$[gt.Choose playlist to copy]' Nop
+ MissingSubmenuFunction FuncFvwmMenuCopyPlaylistDirectory
+ '%22x22/categories/video_movies_view.png%$[gt.Browse Medias]' Popup $[infostore.AudioPlaylists]

# Clear playlist (alsaplayer, audacious, mocp, mpd, xmms2)
DestroyFunc Music-ClearPlaylist

# Load movie playlist (mplayer)
DestroyFunc FuncFvwmMenuMovieDirectory
DestroyMenu /Music/LoadMovie
# Load Media Playlists (mplayer)
DestroyFunc FuncFvwmMenuMediaDirectory
DestroyMenu /Music/LoadMediaPlaylist
# Load playlist (alsaplayer, audacious, mocp, mplayer)
DestroyFunc FuncFvwmMenuAudioDirectory
# Add playlist (xmms2)
DestroyFunc FuncFvwmMenuPlaylistDirectory
DestroyMenu /Music/AddPlaylist
# Load playlist (mpd, xmms2)
DestroyFunc Music-LoadPlaylist-generator
# Load playlist (alsaplayer, audacious, mocp, mpd, mplayer, xmms2)
DestroyMenu /Music/LoadPlaylist
AddToMenu /Music/LoadPlaylist
+ '$[gt.Choose playlist to load]' Nop
+ MissingSubmenuFunction FuncFvwmMenuAudioDirectory
+ '%22x22/categories/video_movies_view.png%$[gt.Audio playlists]' Popup $[infostore.AudioPlaylists]
+ '%22x22/categories/video_movies_view.png%$[gt.Personal audio playlists]' Popup $[infostore.UserManagedAudioPlaylists]

# Load all the songs (mpd)
DestroyFunc Music-LoadAll

# Play DVD (mplayer)
DestroyFunc Load-DVD

# Show current playlist (xmms2)
DestroyFunc Music-CurrentPlaylist-generator
DestroyMenu /Music/CurrentPlaylist

# Remove song (audacious, mpd, xmms2)
DestroyFunc Music-RemoveSong

# Save playlist dialog (audacious, mpdm, xmms2)
All (Music-SavePlaylist-Dialog) Close
DestroyModuleConfig Music-SavePlaylist-Dialog: *
DestroyFunc Music-SavePlaylist

# Update the database (mpd)
DestroyFunc Music-Update

# alsaplayer
DestroyFunc Music-SongChange
DestroyMenu /Music/SongChange

# alsaplayer, audacious, cdcd, cmus, mocp, mpd, quodlibet, xmms2
DestroyFunc Music-Stop

# alsaplayer, audacious, cdcd, cmus, mocp, mpd, quodlibet
DestroyFunc Music-PlayPause

# cdcd, cmus, mpd, quodlibet
DestroyFunc Music-Forward

# cdcd, cmus, mpd, quodlibet
DestroyFunc Music-Backward

# audacious, cmus, mpd, quodlibet
DestroyFunc Music-ToggleRandom

# alsaplayer, mplayer
DestroyFunc Music-Jump
DestroyMenu /Music/Jump

# mpd
DestroyMenu /Music/Crossfade

# mpd, xmms2
DestroyFunc Music-Shuffle

# (all)
DestroyFunc Playback-generator

# alsaplayer
DestroyFunc Music-VolumeFr
DestroyFunc Music-VolumeEn
# audacious, mplayer
DestroyFunc Music-Volume
# mplayer
DestroyFunc Music-VolumeUp
DestroyFunc Music-VolumeDown

# alsaplayer, mplayer
DestroyFunc Music-Speed

# mouse 4 Button-Seek-+ {{{2
# mouse 5 Button-Seek--
# alsaplayer
DestroyFunc Button-Seek-+
DestroyFunc Button-Seek--

# Music menus {{{1
# main music menu (alsaplayer, audacious, cdcd, mocp) {{{2
DestroyFunc Music-generator

DestroyMenu /Music
AddToMenu /Music
+ DynamicPopupAction Function Music-generator

# Button menus {{{1
# # # # # # # # # #
# Button 1 mouse 1 {{{2
# (alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet)
DestroyFunc Player-generator
# Button menu (all)
DestroyMenu /Player
AddToMenu /Player
+ DynamicPopupAction Function Player-generator

# Button 1 mouse 3 {{{2
DestroyFunc Music-QJackGUI
AddToFunc Music-QJackGUI
+ I All (qjackctl) Iconify toggle
+ I TestRc (NoMatch) Test (x qjackctl) Exec pidof qjackctl || exec qjackctl

# Button 1 mouse 4 {{{2
# Mixer-Volume-Up in components/Mixer
# Button 1 mouse 5
# Mixer-Volume-Down in components/Mixer

# Button 2 mouse 1 {{{1
# button menu (alsaplayer, audacious, mocp, mpd, mplayer, xmms2)
DestroyFunc Playlist-generator-button
DestroyMenu /Playlist-button
# mplayer
DestroyMenu /Playlist
DestroyMenu /Playlist-bot
DestroyFunc /Playlist-generator
DestroyFunc /Playlist-generator-bot
DestroyFunc Music-WatchDVB

# Button 2 mouse 2 (alsaplayer, audacious, mplayer) {{{2
DestroyMenu /Music/Volume

# Button 2 mouse 3 {{{2
# /Mixer : in components/Mixer

# Button 2 mouse 4 {{{2
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet, xmms2
DestroyFunc Music-Next

# Button 2 mouse 5 {{{2
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet, xmms2
DestroyFunc Music-Prev

# Button 3 mouse 1 {{{1
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet, xmms2
DestroyFunc Music-Play

# Button 3 mouse 2 {{{2
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet, xmms2
DestroyFunc Music-Pause

# mplayer
DestroyFunc Music-FrameStep

# Button 3 mouse 3 (all) {{{2
DestroyMenu /Playback
AddToMenu /Playback
+ DynamicPopupAction Function Playback-generator

# Button 3 mouse 4 (alsaplayer, mplayer) {{{2
DestroyFunc Music-Speed-Up
# Button 3 mouse 4 (alsaplayer, mplayer) {{{2
DestroyFunc Music-Speed-Down

# Button 4 mouse 1 (alsaplayer, mplayer) {{{1
DestroyMenu /Speed

# Button 4 mouse 4 (alsaplayer, mplayer ) {{{2
# Button 4 mouse 5
DestroyFunc Music-Seek
DestroyMenu /Music/Seek


# vim:ft=fvwm