aboutsummaryrefslogtreecommitdiff
path: root/.config/i3/music.lua
blob: 1960f9bb8ee43bd363753c64ee7b3d266f57f751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local shell_utils = require("shellutils")

local status = shell_utils.get_output("playerctl status")
local song   = shell_utils.get_output("playerctl metadata title")
local artist = shell_utils.get_output("playerctl metadata artist")
local album  = shell_utils.get_output("playerctl metadata album")

if #album ~= 0 then
    album = ("from %s "):format(album)
end

if status == "Playing" then
    print((" Playing | %s by %s %s"):format(song, artist, album))
elseif status == "Paused" then
    print((" Paused  | %s by %s %s"):format(song, artist, album))
else
    print((" Stopped "):format(status))
end