mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-25 09:37:14 +08:00
Former-commit-id: c0cb2979b2
Former-commit-id: b49f80e039a49894ca2cd98679150fba4c091404
Former-commit-id: 785592b3bc72bebb2dad98c6f12ecaa514eaa206
Former-commit-id: 795b8b77c387b84fb24509fa97733a4b578df2d9
42 lines
1.1 KiB
Lua
42 lines
1.1 KiB
Lua
local wibox = require("wibox")
|
|
local awful = require("awful")
|
|
local naughty = require("naughty")
|
|
|
|
-- Declare widgets
|
|
local spotify_artist = wibox.widget.textbox()
|
|
local spotify_title = wibox.widget.textbox()
|
|
|
|
-- Main widget that includes all others
|
|
local spotify_widget = wibox.widget {
|
|
-- Title widget
|
|
{
|
|
align = "center",
|
|
text = "---",
|
|
font = "sans 14",
|
|
widget = spotify_title
|
|
},
|
|
-- Artist widget
|
|
{
|
|
align = "center",
|
|
text = "---",
|
|
font = "sans 10",
|
|
widget = spotify_artist
|
|
},
|
|
spacing = 2,
|
|
layout = wibox.layout.fixed.vertical
|
|
}
|
|
|
|
-- Subcribe to spotify updates
|
|
awesome.connect_signal("evil::spotify", function(artist, title, status)
|
|
-- Do whatever you want with artist, title, status
|
|
-- ...
|
|
spotify_artist.text = artist
|
|
spotify_title.text = title
|
|
|
|
-- Example notification (might not be needed if spotify already sends one)
|
|
if status == "playing" then
|
|
naughty.notify({ title = "Spotify | Now Playing", message = title.." by "..artist })
|
|
end
|
|
end)
|
|
|
|
return spotify_widget
|