diff options
| author | venomade <venomade@venomade.com> | 2026-02-11 11:42:58 +0000 |
|---|---|---|
| committer | venomade <venomade@venomade.com> | 2026-02-11 11:42:58 +0000 |
| commit | 0bd150185551b6d8835d022c15a5f6e832d51113 (patch) | |
| tree | 10bf3f3443df49a44eb47b328b73b7e76b0a4924 /.config/luastatus/playerctl.lua | |
| parent | 8d688d1107c46b6dfdcaf02fa5c9c4c8a4640e65 (diff) | |
Asahi
Soft reset of dotfiles specific to Asahi, Sway and Neovim.
Diffstat (limited to '.config/luastatus/playerctl.lua')
| -rw-r--r-- | .config/luastatus/playerctl.lua | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/.config/luastatus/playerctl.lua b/.config/luastatus/playerctl.lua new file mode 100644 index 0000000..a3e743c --- /dev/null +++ b/.config/luastatus/playerctl.lua @@ -0,0 +1,43 @@ +local player = 'jellyfin-tui' + +widget = { + plugin = 'timer', + opts = { period = 2 }, + cb = function() + + local handle = io.popen('playerctl -p ' .. player .. ' status') + local playerctl_status = string.sub(handle:read("*a"), 1, -2) + handle:close() + + local symbol = '' + + if (playerctl_status == 'Playing') or (playerctl_status == 'Paused') then + local handle = io.popen('playerctl -p ' .. player ..' metadata title') + local playerctl_title = string.sub(handle:read("*a"), 1, -2) + handle:close() + + local handle = io.popen('playerctl -p ' .. player .. ' metadata artist') + local playerctl_artist = string.sub(handle:read("*a"), 1, -2) + handle:close() + + if playerctl_status == 'Playing' then + symbol = '' + end + + return { + { full_text = string.format('%s - %s %s', playerctl_artist, playerctl_title, symbol), color = "#f2cdcd" } + } + end + + return { + { full_text = " "} + } + end, + -- TODO: Figure out if this can stop being hardcoded + event = [[ + local t = ... + if t.button == 1 then + os.execute('playerctl -p jellyfin-tui play-pause') + end + ]], +} |
