| 1 |
# Support for audio players in Fvwm-Crystal: |
| 2 |
# initialisations and some shared functions |
| 3 |
# Written by: Dominique Michel <[email protected]> |
| 4 |
# |
| 5 |
# This file must be included at the top of the music player control files. |
| 6 |
# Include components/functions/Music |
| 7 |
# |
| 8 |
# Some recipes do have a media button, the other do have a menu. |
| 9 |
# Recipes with media button: Amiga, Corner, Default, Default with ACPI, Dock |
| 10 |
# The bindings of the media buttons are: |
| 11 |
# |
| 12 |
# n button n button fumction comment |
| 13 |
# Button 1: (Mouse 1) Menu /Player # Main player menu |
| 14 |
# (Mouse 2) Music-GUI # show/hide the player |
| 15 |
# (Mouse 3) Music-QJackGUI # show/hide QJackCtl + the audio mixer |
| 16 |
# (Mouse 4) Mixer-Volume-Up # main volume up |
| 17 |
# (Mouse 5) Mixer-Volume-Down # main volume down |
| 18 |
# Button 2: (Mouse 1) Menu /Playlist-button # playlist menu |
| 19 |
# (Mouse 2) Menu /Music/Volume # player volume menu |
| 20 |
# (Mouse 3) Menu /Mixer # main mixer menu |
| 21 |
# (Mouse 4) Music-Next # next media |
| 22 |
# (Mouse 5) Music-Prev # previous media |
| 23 |
# Button 3: (Mouse 1) Music-Play # play |
| 24 |
# (Mouse 2) Music-Pause # pause |
| 25 |
# (Mouse 3) Menu /Playback # playback menu |
| 26 |
# (Mouse 4) Music-Speed-Up # speed up |
| 27 |
# (Mouse 5) Music-Speed-Down # speed down |
| 28 |
# Button 4: (Mouse 1) Menu /Speed # speed control menu |
| 29 |
# (Mouse 4) Music-Seek-+ # seek forward |
| 30 |
# (Mouse 5) Music-Seek-- # seek backward |
| 31 |
# NOTE : the actual bindings are fixed into the recipes. |
| 32 |
# |
| 33 |
# Recipes with media menu: Clean, Clean Vertical, Light, Wing-Commander |
| 34 |
# The media menu is: Popup /Music |
| 35 |
# |
| 36 |
# TODO : - Move the media button here |
| 37 |
# - Find something to do with mouse 2 and 3 on button 4 |
| 38 |
############################################################################# |
| 39 |
|
| 40 |
## Amixer and Mplayer are selected as default mixer and player if the user ## |
| 41 |
## didn't changed it. We keep them or the user settings. ## |
| 42 |
|
| 43 |
########################################################################### |
| 44 |
# The playlists was previously in different player dependant places. |
| 45 |
# They are now in 4 places: |
| 46 |
# $[FVWM_USERDIR]/Playlists/Audio for the playlists of audio files |
| 47 |
# $[FVWM_USERDIR]/Playlists/Video for the playlists of movie files |
| 48 |
# $[HOME]/Playlists/Audio for "by the user managed" audio playlists |
| 49 |
# $[HOME]/Playlists/Video for "by the user managed" video playlists |
| 50 |
# |
| 51 |
# 'Recreate the playlist' will manage the playlists in $[FVWM_USERDIR] in a |
| 52 |
# very simple way: delete all and recreate all. At the same time, it will |
| 53 |
# create the user managed directories if they don't exist. |
| 54 |
# |
| 55 |
# Note: according to /etc/xdg/user-dirs.defaults, the default medias paths |
| 56 |
# are $HOME/Music and $HOME/Videos and will be translated on a |
| 57 |
# per-path-element basis into the users locale. |
| 58 |
|
| 59 |
# Mixer {{{1 |
| 60 |
Include components/functions/Mixer |
| 61 |
|
| 62 |
# Variables {{{1 |
| 63 |
# playlists locations {{{2 |
| 64 |
InfoStoreAdd AudioPlaylists "$[FVWM_USERDIR]/Playlists/Audio" |
| 65 |
InfoStoreAdd VideoPlaylists "$[FVWM_USERDIR]/Playlists/Video" |
| 66 |
InfoStoreAdd UserManagedAudioPlaylists "$[HOME]/Playlists/Audio" |
| 67 |
InfoStoreAdd UserManagedVideoPlaylists "$[HOME]/Playlists/Video" |
| 68 |
|
| 69 |
# speed control (alsaplayer, mplayer) {{{2 |
| 70 |
InfoStoreRemove speed |
| 71 |
|
| 72 |
# DVB channel lists (mplayer) {{{2 |
| 73 |
InfoStoreRemove MplayerChannelList1 |
| 74 |
InfoStoreRemove MplayerChannelList2 |
| 75 |
InfoStoreRemove MplayerChannelList3 |
| 76 |
InfoStoreRemove MplayerChannelList4 |
| 77 |
|
| 78 |
# Decimal point in use (alsaplayer) {{{2 |
| 79 |
InfoStoreRemove dec_point |
| 80 |
PipeRead 'if [ $[infostore.MusicPlayer] = alsaplayer ] || [ $[infostore.MusicPlayer] = alsaplayerdaemon ]; \ |
| 81 |
then echo "InfoStoreAdd dec_point `locale decimal_point`"; else echo "InfoStoreRemove dec_point"; fi' |
| 82 |
|
| 83 |
# xmms2 |
| 84 |
InfoStoreRemove fvwm_audio_exec |
| 85 |
|
| 86 |
# Styles for media players windows {{{1 |
| 87 |
Style Alsaplayer NoActiveIconOverride, NoIcon, Sticky, WindowListSkip, StaysOnTop |
| 88 |
Style alsaplayer UseStyle Alsaplayer |
| 89 |
|
| 90 |
Style Audacious StaysOnTop |
| 91 |
Style Audacious StartIconic, NoActiveIconOverride, NoIcon, !Title, Sticky, WindowListSkip |
| 92 |
Style playlist StartIconic, NoIcon, !Title, Sticky, WindowListSkip |
| 93 |
Style equalizer UseStyle playlist |
| 94 |
|
| 95 |
Style beep-media-player !Title |
| 96 |
|
| 97 |
# Cmus (NoIcon doesn't work -> ToDo: use FvwmIdent) |
| 98 |
Style cmus NoActiveIconOverride, NoIcon, Sticky, WindowListSkip, StaysOnTop |
| 99 |
# Mocp (NoIcon doesn't work -> ToDo: use FvwmIdent) |
| 100 |
Style mocp NoActiveIconOverride, NoIcon, Sticky, WindowListSkip, StaysOnTop |
| 101 |
Style MOC UseStyle mocp |
| 102 |
|
| 103 |
Style MPlayer !Title, !Borders, GnomeIgnoreHints, EWMHIgnoreStackingOrderHints |
| 104 |
Style "MPlayer - Video" Title, Borders, GnomeIgnoreHints, EWMHIgnoreStackingOrderHints |
| 105 |
Style XDRadio NoIcon, Sticky, WindowListSkip |
| 106 |
|
| 107 |
Style quodlibet StaysOnTop, NoIcon, Sticky, WindowListSkip |
| 108 |
|
| 109 |
Style gxmms2 StaysOnTop, NoIcon, Sticky, WindowListSkip |
| 110 |
|
| 111 |
Style qjackctl NoActiveIconOverride, NoIcon, Sticky, WindowListSkip |
| 112 |
|
| 113 |
# Functions {{{1 |
| 114 |
# menu /Player {{{2 |
| 115 |
# Recreate the playlists (all) |
| 116 |
DestroyFunc Music-RecreatePlaylist |
| 117 |
AddToFunc Music-RecreatePlaylist |
| 118 |
+ I A $[FVWM_SYSTEMDIR]/scripts/make_all_playlists $[infostore.AudioPlaylists] $[infostore.VideoPlaylists] $[infostore.UserManagedAudioPlaylists] $[infostore.UserManagedVideoPlaylists] |
| 119 |
|
| 120 |
# start the player(s) (alsaplayer, mplayer) |
| 121 |
DestroyFunc Music-Start |
| 122 |
DestroyMenu /Music/Start |
| 123 |
|
| 124 |
# player quit (alsaplayer, mplayer) |
| 125 |
DestroyFunc Music-Kill |
| 126 |
|
| 127 |
# show/hyde the player GUI/menu (alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet) |
| 128 |
DestroyFunc Music-GUI |
| 129 |
|
| 130 |
# wrapper for cdcd |
| 131 |
DestroyFunc Music-cdcd |
| 132 |
|
| 133 |
# Second button {{{1 |
| 134 |
# Player controls and main vol |
| 135 |
# mouse 1 Menu /Playlist-button {{{2 |
| 136 |
|
| 137 |
# Remove playlist (all) |
| 138 |
DestroyFunc Music-RemovePlaylist-generator |
| 139 |
AddToFunc Music-RemovePlaylist-generator |
| 140 |
+ I DestroyMenu recreate /Music/RemovePlaylist |
| 141 |
+ I AddToMenu /Music/RemovePlaylist |
| 142 |
+ I PipeRead 'for i in $[infostore.UserManagedAudioPlaylists]/*.{m3u,pls}; do \ |
| 143 |
name=$(basename "$i"); \ |
| 144 |
sname=${name%%.m3u}; \ |
| 145 |
sname=${sname%%.pls}; \ |
| 146 |
echo \"AddToMenu /Music/RemovePlaylist \'$sname\' Exec rm -f \'$i\'\"; done' |
| 147 |
|
| 148 |
DestroyMenu /Music/RemovePlaylist |
| 149 |
AddToMenu /Music/RemovePlaylist |
| 150 |
+ DynamicPopupAction Function Music-RemovePlaylist-generator |
| 151 |
|
| 152 |
# Copy playlist (all) |
| 153 |
# Note: Visualy redundant; TODO: A recursive generator like in remove playlist |
| 154 |
DestroyFunc FuncFvwmMenuCopyPlaylistDirectory |
| 155 |
AddToFunc FuncFvwmMenuCopyPlaylistDirectory |
| 156 |
+ I PipeRead 'case \"$0\" in \ |
| 157 |
"$[infostore.AudioPlaylists]"*) myexec="Exec cp -r \'%f\' \'$[infostore.UserManagedAudioPlaylists]\'";; \ |
| 158 |
esac; \ |
| 159 |
test -f \"$0\"/.icontitle.png && mytitle=\"$0\"/.icontitle.png; \ |
| 160 |
test -f \"$0\"/.media.png && mypng=\"$0\"/.media.png; \ |
| 161 |
fvwm-menu-directory --icon-title "${mytitle:-22x22/categories/directory.png}" \ |
| 162 |
--icon-file "${mypng:-22x22/categories/Audio.png}" \ |
| 163 |
--dir \"$0\" --exec-title "-" --command-file "${myexec}" \ |
| 164 |
--func-name "FuncFvwmMenuCopyPlaylistDirectory"' |
| 165 |
|
| 166 |
DestroyMenu /Music/CopyPlaylist |
| 167 |
AddToMenu /Music/CopyPlaylist |
| 168 |
#+ '$[gt.Choose playlist to copy]' Nop |
| 169 |
+ MissingSubmenuFunction FuncFvwmMenuCopyPlaylistDirectory |
| 170 |
+ '%22x22/categories/video_movies_view.png%$[gt.Browse Medias]' Popup $[infostore.AudioPlaylists] |
| 171 |
|
| 172 |
# Clear playlist (alsaplayer, audacious, mocp, mpd, xmms2) |
| 173 |
DestroyFunc Music-ClearPlaylist |
| 174 |
|
| 175 |
# Load movie playlist (mplayer) |
| 176 |
DestroyFunc FuncFvwmMenuMovieDirectory |
| 177 |
DestroyMenu /Music/LoadMovie |
| 178 |
# Load Media Playlists (mplayer) |
| 179 |
DestroyFunc FuncFvwmMenuMediaDirectory |
| 180 |
DestroyMenu /Music/LoadMediaPlaylist |
| 181 |
# Load playlist (alsaplayer, audacious, mocp, mplayer) |
| 182 |
DestroyFunc FuncFvwmMenuAudioDirectory |
| 183 |
# Add playlist (xmms2) |
| 184 |
DestroyFunc FuncFvwmMenuPlaylistDirectory |
| 185 |
DestroyMenu /Music/AddPlaylist |
| 186 |
# Load playlist (mpd, xmms2) |
| 187 |
DestroyFunc Music-LoadPlaylist-generator |
| 188 |
# Load playlist (alsaplayer, audacious, mocp, mpd, mplayer, xmms2) |
| 189 |
DestroyMenu /Music/LoadPlaylist |
| 190 |
AddToMenu /Music/LoadPlaylist |
| 191 |
+ '$[gt.Choose playlist to load]' Nop |
| 192 |
+ MissingSubmenuFunction FuncFvwmMenuAudioDirectory |
| 193 |
+ '%22x22/categories/video_movies_view.png%$[gt.Audio playlists]' Popup $[infostore.AudioPlaylists] |
| 194 |
+ '%22x22/categories/video_movies_view.png%$[gt.Personal audio playlists]' Popup $[infostore.UserManagedAudioPlaylists] |
| 195 |
|
| 196 |
# Load all the songs (mpd) |
| 197 |
DestroyFunc Music-LoadAll |
| 198 |
|
| 199 |
# Play DVD (mplayer) |
| 200 |
DestroyFunc Load-DVD |
| 201 |
|
| 202 |
# Show current playlist (xmms2) |
| 203 |
DestroyFunc Music-CurrentPlaylist-generator |
| 204 |
DestroyMenu /Music/CurrentPlaylist |
| 205 |
|
| 206 |
# Remove song (audacious, mpd, xmms2) |
| 207 |
DestroyFunc Music-RemoveSong |
| 208 |
|
| 209 |
# Save playlist dialog (audacious, mpdm, xmms2) |
| 210 |
All (Music-SavePlaylist-Dialog) Close |
| 211 |
DestroyModuleConfig Music-SavePlaylist-Dialog: * |
| 212 |
DestroyFunc Music-SavePlaylist |
| 213 |
|
| 214 |
# Update the database (mpd) |
| 215 |
DestroyFunc Music-Update |
| 216 |
|
| 217 |
# alsaplayer |
| 218 |
DestroyFunc Music-SongChange |
| 219 |
DestroyMenu /Music/SongChange |
| 220 |
|
| 221 |
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, quodlibet, xmms2 |
| 222 |
DestroyFunc Music-Stop |
| 223 |
|
| 224 |
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, quodlibet |
| 225 |
DestroyFunc Music-PlayPause |
| 226 |
|
| 227 |
# cdcd, cmus, mpd, quodlibet |
| 228 |
DestroyFunc Music-Forward |
| 229 |
|
| 230 |
# cdcd, cmus, mpd, quodlibet |
| 231 |
DestroyFunc Music-Backward |
| 232 |
|
| 233 |
# audacious, cmus, mpd, quodlibet |
| 234 |
DestroyFunc Music-ToggleRandom |
| 235 |
|
| 236 |
# alsaplayer, mplayer |
| 237 |
DestroyFunc Music-Jump |
| 238 |
DestroyMenu /Music/Jump |
| 239 |
|
| 240 |
# mpd |
| 241 |
DestroyMenu /Music/Crossfade |
| 242 |
|
| 243 |
# mpd, xmms2 |
| 244 |
DestroyFunc Music-Shuffle |
| 245 |
|
| 246 |
# (all) |
| 247 |
DestroyFunc Playback-generator |
| 248 |
|
| 249 |
# alsaplayer |
| 250 |
DestroyFunc Music-VolumeFr |
| 251 |
DestroyFunc Music-VolumeEn |
| 252 |
# audacious, mplayer |
| 253 |
DestroyFunc Music-Volume |
| 254 |
# mplayer |
| 255 |
DestroyFunc Music-VolumeUp |
| 256 |
DestroyFunc Music-VolumeDown |
| 257 |
|
| 258 |
# alsaplayer, mplayer |
| 259 |
DestroyFunc Music-Speed |
| 260 |
|
| 261 |
# mouse 4 Button-Seek-+ {{{2 |
| 262 |
# mouse 5 Button-Seek-- |
| 263 |
# alsaplayer |
| 264 |
DestroyFunc Button-Seek-+ |
| 265 |
DestroyFunc Button-Seek-- |
| 266 |
|
| 267 |
# Music menus {{{1 |
| 268 |
# main music menu (alsaplayer, audacious, cdcd, mocp) {{{2 |
| 269 |
DestroyFunc Music-generator |
| 270 |
|
| 271 |
DestroyMenu /Music |
| 272 |
AddToMenu /Music |
| 273 |
+ DynamicPopupAction Function Music-generator |
| 274 |
|
| 275 |
# Button menus {{{1 |
| 276 |
# # # # # # # # # # |
| 277 |
# Button 1 mouse 1 {{{2 |
| 278 |
# (alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet) |
| 279 |
DestroyFunc Player-generator |
| 280 |
# Button menu (all) |
| 281 |
DestroyMenu /Player |
| 282 |
AddToMenu /Player |
| 283 |
+ DynamicPopupAction Function Player-generator |
| 284 |
|
| 285 |
# Button 1 mouse 3 {{{2 |
| 286 |
DestroyFunc Music-QJackGUI |
| 287 |
AddToFunc Music-QJackGUI |
| 288 |
+ I All (qjackctl) Iconify toggle |
| 289 |
#+ I TestRc (NoMatch) Test (x qjackctl) Exec pidof qjackctl || exec qjackctl |
| 290 |
+ I Mixer-GUI |
| 291 |
|
| 292 |
# Button 1 mouse 4 {{{2 |
| 293 |
# Mixer-Volume-Up in components/Mixer |
| 294 |
# Button 1 mouse 5 |
| 295 |
# Mixer-Volume-Down in components/Mixer |
| 296 |
|
| 297 |
# Button 2 mouse 1 {{{1 |
| 298 |
# button menu (alsaplayer, audacious, mocp, mpd, mplayer, xmms2) |
| 299 |
DestroyFunc Playlist-generator-button |
| 300 |
DestroyMenu /Playlist-button |
| 301 |
# mplayer |
| 302 |
DestroyMenu /Playlist |
| 303 |
DestroyMenu /Playlist-bot |
| 304 |
DestroyFunc /Playlist-generator |
| 305 |
DestroyFunc /Playlist-generator-bot |
| 306 |
DestroyFunc Music-WatchDVB |
| 307 |
|
| 308 |
# Button 2 mouse 2 (alsaplayer, audacious, mplayer) {{{2 |
| 309 |
DestroyMenu /Music/Volume |
| 310 |
|
| 311 |
# Button 2 mouse 3 {{{2 |
| 312 |
# /Mixer : in components/Mixer |
| 313 |
|
| 314 |
# Button 2 mouse 4 {{{2 |
| 315 |
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet, xmms2 |
| 316 |
DestroyFunc Music-Next |
| 317 |
|
| 318 |
# Button 2 mouse 5 {{{2 |
| 319 |
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet, xmms2 |
| 320 |
DestroyFunc Music-Prev |
| 321 |
|
| 322 |
# Button 3 mouse 1 {{{1 |
| 323 |
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet, xmms2 |
| 324 |
DestroyFunc Music-Play |
| 325 |
|
| 326 |
# Button 3 mouse 2 {{{2 |
| 327 |
# alsaplayer, audacious, cdcd, cmus, mocp, mpd, mplayer, quodlibet, xmms2 |
| 328 |
DestroyFunc Music-Pause |
| 329 |
|
| 330 |
# mplayer |
| 331 |
DestroyFunc Music-FrameStep |
| 332 |
|
| 333 |
# Button 3 mouse 3 (all) {{{2 |
| 334 |
DestroyMenu /Playback |
| 335 |
AddToMenu /Playback |
| 336 |
+ DynamicPopupAction Function Playback-generator |
| 337 |
|
| 338 |
# Button 3 mouse 4 (alsaplayer, mplayer) {{{2 |
| 339 |
DestroyFunc Music-Speed-Up |
| 340 |
# Button 3 mouse 4 (alsaplayer, mplayer) {{{2 |
| 341 |
DestroyFunc Music-Speed-Down |
| 342 |
|
| 343 |
# Button 4 mouse 1 (alsaplayer, mplayer) {{{1 |
| 344 |
DestroyMenu /Speed |
| 345 |
|
| 346 |
# Button 4 mouse 4 (alsaplayer, mplayer ) {{{2 |
| 347 |
# Button 4 mouse 5 |
| 348 |
DestroyFunc Music-Seek |
| 349 |
DestroyMenu /Music/Seek |
| 350 |
|
| 351 |
# Tooltip (alsaplayer, mplayer*) {{{1 |
| 352 |
DestroyFunc Tittle-Tooltip |
| 353 |
DestroyFunc Music-Tooltip |
| 354 |
|
| 355 |
# vim:ft=fvwm |