2017-01-23 17:01:16 +01:00
|
|
|
local wibox = require("wibox")
|
|
|
|
local awful = require("awful")
|
2017-01-26 04:47:50 +01:00
|
|
|
local watch = require("awful.widget.watch")
|
2017-01-23 17:01:16 +01:00
|
|
|
|
|
|
|
spotify_widget = wibox.widget.textbox()
|
|
|
|
spotify_widget:set_font('Play 9')
|
2017-04-01 04:11:09 +02:00
|
|
|
spotify_widget:connect_signal("button::release", function() awful.spawn('sp play'); end)
|
2017-01-23 17:01:16 +01:00
|
|
|
|
2017-01-26 04:47:50 +01:00
|
|
|
-- optional icon, could be replaced by spotfiy logo (https://developer.spotify.com/design/)
|
|
|
|
spotify_icon = wibox.widget.imagebox()
|
2017-02-02 03:45:15 +01:00
|
|
|
spotify_icon:set_image("/usr/share/icons/Arc/devices/22/audio-headphones.png")
|
2017-01-23 17:01:16 +01:00
|
|
|
|
2017-01-26 04:47:50 +01:00
|
|
|
watch(
|
|
|
|
"sp current-oneline", 1,
|
|
|
|
function(widget, stdout, stderr, exitreason, exitcode)
|
|
|
|
spotify_widget:set_text(stdout)
|
|
|
|
end
|
2017-04-01 04:11:09 +02:00
|
|
|
)
|
2017-06-04 02:43:03 +02:00
|
|
|
|
|
|
|
spotify_widget:connect_signal("button::press", function(_,_,_,button)
|
|
|
|
if (button == 1) then awful.spawn("sp play", false) end
|
|
|
|
end)
|