diff --git a/docs/signals/pctl.md b/docs/signals/pctl.md index b06d69c..dd2ee48 100644 --- a/docs/signals/pctl.md +++ b/docs/signals/pctl.md @@ -7,6 +7,7 @@ This is a signal module in which you can connect to certain bling signals to gra - If playing or not - Position - Song length +- If there are no players on This module relies on `playerctl` and `curl`. If you have this module disabled, you won't need those programs. With this module, you can create a widget like below without worrying about the backend. @@ -30,6 +31,8 @@ Here are the signals available: -- bling::playerctl::position -- interval_sec (number) -- length_sec (number) +-- bling::playerctl::player_stopped +-- (No params) ``` ### Example Implementation diff --git a/signal/playerctl.lua b/signal/playerctl.lua index 09c6811..455639e 100644 --- a/signal/playerctl.lua +++ b/signal/playerctl.lua @@ -1,3 +1,4 @@ +-- -- Provides: -- bling::playerctl::status -- playing (boolean) @@ -8,6 +9,7 @@ -- bling::playerctl::position -- interval_sec (number) -- length_sec (number) +-- bling::playerctl::player_stopped -- local awful = require("awful") local beautiful = require("beautiful") @@ -92,10 +94,14 @@ echo "$tmp_cover_path" -- Get title and artist local artist = line:match('artist_(.*)title_') local title = line:match('title_(.*)') + -- If the title is nil or empty then the players stopped if title and title ~= "" then awesome.emit_signal( "bling::playerctl::title_artist_album", title, artist, album_path) + else + awesome.emit_signal( + "bling::playerctl::player_stopped") end end) end