aboutsummaryrefslogtreecommitdiff
path: root/.config/i3/music.lua
blob: 5f60a4b26f6591810b30f9b906e474d2c55b0b48 (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