summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mpdarc-widget/README.md14
-rw-r--r--mpdarc-widget/mpdarc.lua11
2 files changed, 20 insertions, 5 deletions
diff --git a/mpdarc-widget/README.md b/mpdarc-widget/README.md
new file mode 100644
index 0000000..57af939
--- /dev/null
+++ b/mpdarc-widget/README.md
@@ -0,0 +1,14 @@
+# MPD Widget
+
+Music Player Daemon widget by [@raphaelfournier](@https://github.com/raphaelfournier).
+
+# Prerequisite
+
+Install `mpd` (Music Player Daemon itself) and `mpc` (Music Player Client - program for controlling mpd), both should be available in repo, e.g for Ubuntu:
+
+.{% highlight bash %}
+sudo apt-get install mpd mpc
+{% endhighlight %}
+
+Set them up and then just follow the [installation](https://github.com/streetturtle/awesome-wm-widgets#installation) section of the repo.
+
diff --git a/mpdarc-widget/mpdarc.lua b/mpdarc-widget/mpdarc.lua
index 317f0bd..56009ef 100644
--- a/mpdarc-widget/mpdarc.lua
+++ b/mpdarc-widget/mpdarc.lua
@@ -15,8 +15,9 @@ local naughty = require("naughty")
local GET_MPD_CMD = "mpc status"
local PAUSE_MPD_CMD = "mpc pause"
-local START_MPD_CMD = "mpc play"
local STOP_MPD_CMD = "mpc stop"
+local NEXT_MPD_CMD = "mpc next"
+local PREV_MPD_CMD = "mpc prev"
local PATH_TO_ICONS = "/usr/share/icons/Arc"
local PAUSE_ICON_NAME = PATH_TO_ICONS .. "/actions/24/player_pause.png"
@@ -66,10 +67,10 @@ end
mpdarc:connect_signal("button::press", function(_, _, _, button)
if (button == 1) then awful.spawn("mpc toggle", false) -- left click
- elseif (button == 2) then awful.spawn("mpc stop", false)
- elseif (button == 3) then awful.spawn("mpc pause", false)
- elseif (button == 4) then awful.spawn("mpc next", false) -- scroll up
- elseif (button == 5) then awful.spawn("mpc prev", false) -- scroll down
+ elseif (button == 2) then awful.spawn(STOP_MPD_CMD, false)
+ elseif (button == 3) then awful.spawn(PAUSE_MPD_CMD, false)
+ elseif (button == 4) then awful.spawn(NEXT_MPD_CMD, false) -- scroll up
+ elseif (button == 5) then awful.spawn(PREV_MPD_CMD, false) -- scroll down
end
spawn.easy_async(GET_MPD_CMD, function(stdout, stderr, exitreason, exitcode)