]> 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 Home (markdown)
[etc/awesome.git] / mpd.md
1 Shows MPD status in a textbox.
2
3         mympd = lain.widgets.mpd()
4
5 Now playing songs are notified like this:
6
7         +--------------------------------------------------------+
8         | +-------+                                              |
9         | |/^\_/^\| Now playing                                  |
10     | |\ O O /| Cannibal Corpse (Hammer Smashed Face) - 1993 |
11     | | '.o.' | Hammer Smashed Face (Radio Disney Version)   |
12         | +-------+                                              |
13         +--------------------------------------------------------+
14
15 Dependencies
16
17 - imagemagick
18
19 The function takes a table as optional argument, which can contain:
20
21 Variable | Meaning | Type | Default
22 --- | --- | --- | ---
23 `password` | MPD password | string | ""
24 `host` | MPD server | string | "127.0.0.1"
25 `port` | MPD port | string | "6600"
26 `music_dir` | Music directory | string | "~/Music"
27 `refresh_timeout` | Refresh timeout seconds | int | 1
28 `color_artist` | Artist value color | string | `beautiful.fg_normal` or "#FFFFFF"
29 `color_song` | Song value color | string | `beautiful.fg_focus` or "#FFFFFF"
30 `spr` | Separator text between artist and song values | string | " "
31 `app` | Music program to spawn on click | string | "ncmpcpp"
32 `shadow` | Hide widget when there are no songs playing | boolean | false 
33
34 **Note**: `spr` can be a markup text.
35
36 `lain.widgets.mpd` outputs the following table:
37
38 Variable | Meaning | Type
39 --- | --- | ---
40 `widget` | The textbox | `wibox.widget.textbox`
41 `notify` | The notification | function
42
43 Finally, you can control the widget with key bindings like these:
44
45     -- MPD control
46     awful.key({ altkey, "Control" }, "Up",
47     function ()
48         awful.util.spawn_with_shell( "mpc toggle || ncmpcpp toggle || ncmpc toggle || pms toggle", false )
49         mympd.notify()
50      end),
51     awful.key({ altkey, "Control" }, "Down",
52     function ()
53         awful.util.spawn_with_shell( "mpc stop || ncmpcpp stop || ncmpc stop || pms stop", false )
54         mympd.notify()
55     end),
56     awful.key({ altkey, "Control" }, "Left",
57     function ()
58         awful.util.spawn_with_shell( "mpc prev || ncmpcpp prev || ncmpc prev || pms prev", false )
59         mympd.notify()
60     end),
61     awful.key({ altkey, "Control" }, "Right",
62     function ()
63         awful.util.spawn_with_shell( "mpc next || ncmpcpp next || ncmpc next || pms next", false )
64         mympd.notify()
65     end),
66
67 where `altkey = "Mod1"`.