]> git.madduck.net Git - etc/awesome.git/blob - mpd.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Updated mpd (markdown)
[etc/awesome.git] / mpd.md
1 [<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
2
3 Shows MPD status in a textbox.
4
5         mpdwidget = lain.widgets.mpd()
6
7 Now playing songs are notified like this:
8
9         +--------------------------------------------------------+
10         | +-------+                                              |
11         | |/^\_/^\| Now playing                                  |
12     | |\ O O /| Cannibal Corpse (Hammer Smashed Face) - 1993 |
13     | | '.o.' | Hammer Smashed Face (Radio Disney Version)   |
14         | +-------+                                              |
15         +--------------------------------------------------------+
16
17 ### input table
18
19 Variable | Meaning | Type | Default
20 --- | --- | --- | ---
21 `timeout` | Refresh timeout seconds | int | 1
22 `password` | MPD password | string | ""
23 `host` | MPD server | string | "127.0.0.1"
24 `port` | MPD port | string | "6600"
25 `music_dir` | Music directory | string | "~/Music"
26 `settings` | User settings | function | empty function
27
28 `settings` can use `mpd_now` table, which contains the following string values:
29
30 - state (possible values: "play", "pause", "stop")
31 - file
32 - artist
33 - title
34 - album
35 - date
36
37 and can modify `notification_preset` table, which will be the preset for the naughty notifications. Check [here](http://awesome.naquadah.org/doc/api/modules/naughty.html#notify) for the list of variables it can contain. Default definition:
38
39     notification _preset = {
40        title   = "Now playing",
41        text    = mpd_now.artist .. " ("   ..
42                  mpd_now.album  .. ") - " ..
43                  mpd_now.date   .. "\n"   ..
44                  mpd_now.title,
45        fg      = beautiful.fg_normal or "#FFFFFF",
46        bg      = beautiful.bg_normal or "#000000",
47        timeout = 6
48     }
49
50 ### output table
51
52 Variable | Meaning | Type
53 --- | --- | ---
54 `widget` | The textbox | `wibox.widget.textbox`
55 `notify` | The notification | function
56
57 You can control the widget with key bindings like these:
58
59     -- MPD control
60     awful.key({ altkey, "Control" }, "Up",
61         function ()
62             awful.util.spawn_with_shell("mpc toggle || ncmpcpp toggle || ncmpc toggle || pms toggle")
63             mpdwidget.notify()
64         end),
65     awful.key({ altkey, "Control" }, "Down",
66         function ()
67             awful.util.spawn_with_shell("mpc stop || ncmpcpp stop || ncmpc stop || pms stop")
68             mpdwidget.notify()
69         end),
70     awful.key({ altkey, "Control" }, "Left",
71         function ()
72             awful.util.spawn_with_shell("mpc prev || ncmpcpp prev || ncmpc prev || pms prev")
73             mpdwidget.notify()
74         end),
75     awful.key({ altkey, "Control" }, "Right",
76         function ()
77             awful.util.spawn_with_shell("mpc next || ncmpcpp next || ncmpc next || pms next")
78             mpdwidget.notify()
79         end),
80
81 where `altkey = "Mod1"`.