From bebf597a484f2e5aaff2ea2e53550e4561162ee0 Mon Sep 17 00:00:00 2001 From: Jan-David Quesel Date: Fri, 24 Oct 2008 15:24:26 +0200 Subject: [PATCH] documentation --- plugins/mpd.lua | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/plugins/mpd.lua b/plugins/mpd.lua index f7a8969..d18a1f1 100644 --- a/plugins/mpd.lua +++ b/plugins/mpd.lua @@ -8,11 +8,22 @@ mpd.lua - wmiirc-lua plugin for monitoring and controlling mpd (music player dae =head1 SYNOPSIS -- in your wmiirc.lua: - wmii.load_plugin("cpu") + mpd = wmii.load_plugin("mpd") =head1 DESCRIPTION +For binding the mpd controls to the multimedia keys you could add +the following keyhandlers to your wmiirc.lua: + +wmii.add_key_handler('XF86AudioNext', mpd.next_song()) + +wmii.add_key_handler('XF86AudioPrev', mpd.prev_song()) + +wmii.add_key_handler('XF86AudioPlay', mpd.toggle_pause()) + +wmii.add_key_handler('XF86AudioStop', mpd.stop()) + =head1 SEE ALSO L, L @@ -33,9 +44,7 @@ is NO WARRANTY, to the extent permitted by law. --]] local wmii = require("wmii") local io = require("io") -local os = require("os") local string = require("string") -local tonumber = tonumber module("mpd") api_version=0.1 @@ -90,5 +99,17 @@ function stop() update_mpd_status(0) end +function register_action() + wmii.add_action_handler ("mpd", + function(act,args) + local actions = { 'play', 'pause', 'stop', 'next', 'prev' } + local act = wmii.menu(actions, "mpd: ") + local fn = function_handlers[act] + if fn then + local r, err = pcall (fn) + end + end) +end + local timer = wmii.timer:new (update_mpd_status, 1) -- 2.11.4.GIT