-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathtrack-notifier.lua
More file actions
20 lines (18 loc) · 665 Bytes
/
Copy pathtrack-notifier.lua
File metadata and controls
20 lines (18 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- track-notifier: show a "Now playing" toast and a playbar segment on every track change.
--
-- Install (single file):
-- cp track-notifier.lua ~/.config/spotatui/plugins/
-- Then restart spotatui.
spotatui.on("track_change", function(pb)
if pb and pb.track then
local artists = table.concat(pb.track.artists, ", ")
spotatui.notify("Now playing: " .. pb.track.name .. " - " .. artists, 4)
spotatui.set_playbar(pb.track.name)
else
-- Nothing playing: clear our playbar segment.
spotatui.set_playbar(nil)
end
end)
spotatui.on("start", function()
spotatui.log("track-notifier loaded (api version " .. spotatui.api_version .. ")")
end)