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

7640b4c4855ee3372515d805e792ed462972ee8a
[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         mympd = 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 Dependencies
18
19 - imagemagick
20
21 The function takes a table as optional argument, which can contain:
22
23 Variable | Meaning | Type | Default
24 --- | --- | --- | ---
25 `password` | MPD password | string | ""
26 `host` | MPD server | string | "127.0.0.1"
27 `port` | MPD port | string | "6600"
28 `music_dir` | Music directory | string | "~/Music"
29 `refresh_timeout` | Refresh timeout seconds | int | 1
30 `pre` | Text before values | string | "" 
31 `header_color` | Artist value color | string | `beautiful.fg_normal` or "#FFFFFF"
32 `color` | Song value color | string | `beautiful.fg_focus` or "#FFFFFF"
33 `spr` | Separator text between artist and song values | string | " "
34 `footer` | Text to append after values | string | "" 
35 `app` | Music program to spawn on click | string | "ncmpcpp"
36 `shadow` | Hide widget when there are no songs playing | boolean | false 
37
38 **Note**: `spr` and `footer` can be markup text.
39
40 `lain.widgets.mpd` outputs the following table:
41
42 Variable | Meaning | Type
43 --- | --- | ---
44 `widget` | The textbox | `wibox.widget.textbox`
45 `notify` | The notification | function
46
47 Finally, you can control the widget with key bindings like these:
48
49     -- MPD control
50     awful.key({ altkey, "Control" }, "Up",
51         function ()
52             awful.util.spawn_with_shell("mpc toggle || ncmpcpp toggle || ncmpc toggle || pms toggle")
53             mpdwidget.notify()
54         end),
55     awful.key({ altkey, "Control" }, "Down",
56         function ()
57             awful.util.spawn_with_shell("mpc stop || ncmpcpp stop || ncmpc stop || pms stop")
58             mpdwidget.notify()
59         end),
60     awful.key({ altkey, "Control" }, "Left",
61         function ()
62             awful.util.spawn_with_shell("mpc prev || ncmpcpp prev || ncmpc prev || pms prev")
63             mpdwidget.notify()
64         end),
65     awful.key({ altkey, "Control" }, "Right",
66         function ()
67             awful.util.spawn_with_shell("mpc next || ncmpcpp next || ncmpc next || pms next")
68             mpdwidget.notify()
69         end),
70
71 where `altkey = "Mod1"`.