]> git.rmz.io Git - dotfiles.git/blob - awesome/widgets/awesompd.lua
awesome: new mpd widget using mpc.lua
[dotfiles.git] / awesome / widgets / awesompd.lua
1 local awesompd = require("widgets/awesompd/awesompd")
2 local musicwidget
3
4 musicwidget = awesompd:create() -- Create awesompd widget
5 musicwidget.font = "Liberation Mono" -- Set widget font
6 musicwidget.scrolling = true -- If true, the text in the widget will be scrolled
7 musicwidget.output_size = 30 -- Set the size of widget in symbols
8 musicwidget.update_interval = 1 -- Set the update interval in seconds
9 -- Set the folder where icons are located
10 musicwidget.path_to_icons = awful.util.getdir("config").."/widgets/awesompd/icons"
11 -- Set the default music format for Jamendo streams. You can change
12 -- this option on the fly in awesompd itself.
13 -- possible formats: awesompd.FORMAT_MP3, awesompd.FORMAT_OGG
14 musicwidget.jamendo_format = awesompd.FORMAT_OGG
15 -- If true, song notifications for Jamendo tracks and local tracks will also contain
16 -- album cover image.
17 musicwidget.show_album_cover = true
18 -- Specify how big in pixels should an album cover be. Maximum value
19 -- is 100.
20 musicwidget.album_cover_size = 50
21 -- This option is necessary if you want the album covers to be shown
22 -- for your local tracks.
23 musicwidget.mpd_config = os.getenv("XDG_CONFIG_HOME").."/mpd/mpd.conf"
24 -- Specify the browser you use so awesompd can open links from
25 -- Jamendo in it.
26 musicwidget.browser = "rifle"
27 -- Specify decorators on the left and the right side of the
28 -- widget. Or just leave empty strings if you decorate the widget
29 -- from outside.
30 musicwidget.ldecorator = ""
31 musicwidget.rdecorator = " "
32 -- Set all the servers to work with (here can be any servers you use)
33 musicwidget.servers = {
34 { server = "localhost",
35 port = 6600 } }
36 -- Set the buttons of the widget
37 musicwidget:register_buttons({
38 { "", awesompd.MOUSE_LEFT, musicwidget:command_playpause() },
39 { "Control", awesompd.MOUSE_SCROLL_UP, musicwidget:command_prev_track() },
40 { "Control", awesompd.MOUSE_SCROLL_DOWN, musicwidget:command_next_track() },
41 { "", awesompd.MOUSE_SCROLL_UP, musicwidget:command_volume_up() },
42 { "", awesompd.MOUSE_SCROLL_DOWN, musicwidget:command_volume_down() },
43 { "", awesompd.MOUSE_RIGHT, musicwidget:command_show_menu() },
44 { modkey, "p", musicwidget:command_playpause() },
45 { modkey, ",", musicwidget:command_prev_track() },
46 { modkey, ".", musicwidget:command_next_track() },
47 { modkey, "'", function() musicwidget.to_notify = true end },
48 { { modkey, "Shift" }, ",", musicwidget:command_previous_server() },
49 { { modkey, "Shift" }, ".", musicwidget:command_next_server() },
50 { "", "XF86AudioPlay", musicwidget:command_playpause() },
51 { "", "XF86AudioPrev", musicwidget:command_prev_track() },
52 { "", "XF86AudioNext", musicwidget:command_next_track() },
53 { "Shift", "XF86AudioPrev", musicwidget:command_previous_server() },
54 { "Shift", "XF86AudioNext", musicwidget:command_next_server() }
55 })
56
57 -- register global_keys
58 musicwidget:append_global_keys()
59 -- After all configuration is done, run the widget
60 musicwidget:run()
61
62 return musicwidget.widget