]> 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:

7db0498f18e4ad3e8a77a20e08eccc040371dfc7
[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 You need a file like this
18
19      (front|cover|art|Folder|folder)\.(jpg|jpeg|png|gif)
20
21 in the album folder in order to show album art too.
22
23 ### input table
24
25 Variable | Meaning | Type | Default
26 --- | --- | --- | ---
27 `timeout` | Refresh timeout seconds | int | 1
28 `password` | MPD password | string | ""
29 `host` | MPD server | string | "127.0.0.1"
30 `port` | MPD port | string | "6600"
31 `music_dir` | Music directory | string | "~/Music"
32 `cover_size` | Album art notification size | int | 100
33 `settings` | User settings | function | empty function
34
35 `settings` can use `mpd_now` table, which contains the following string values:
36
37 - state (possible values: "play", "pause", "stop")
38 - file
39 - artist
40 - title
41 - album
42 - date
43
44 and can modify `mpd_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:
45
46     mpd_notification _preset = {
47        title   = "Now playing",
48        timeout = 6,
49        text    = string.format("%s (%s) - %s\n%s", mpd_now.artist,
50                  mpd_now.album, mpd_now.date, mpd_now.title)
51     }
52
53 ### output table
54
55 Variable | Meaning | Type
56 --- | --- | ---
57 `widget` | The textbox | `wibox.widget.textbox`
58 `update` | The notification | function
59
60 You can control the widget with key bindings like these:
61
62     -- MPD control
63     awful.key({ altkey, "Control" }, "Up",
64         function ()
65             awful.util.spawn_with_shell("mpc toggle || ncmpcpp toggle || ncmpc toggle || pms toggle")
66             mpdwidget.update()
67         end),
68     awful.key({ altkey, "Control" }, "Down",
69         function ()
70             awful.util.spawn_with_shell("mpc stop || ncmpcpp stop || ncmpc stop || pms stop")
71             mpdwidget.update()
72         end),
73     awful.key({ altkey, "Control" }, "Left",
74         function ()
75             awful.util.spawn_with_shell("mpc prev || ncmpcpp prev || ncmpc prev || pms prev")
76             mpdwidget.update()
77         end),
78     awful.key({ altkey, "Control" }, "Right",
79         function ()
80             awful.util.spawn_with_shell("mpc next || ncmpcpp next || ncmpc next || pms next")
81             mpdwidget.update()
82         end),
83
84 where `altkey = "Mod1"`.