From dd0012364eb7d03e648b16ddf137d42f1758cf42 Mon Sep 17 00:00:00 2001 From: Gokul Swami Date: Tue, 16 Feb 2021 17:25:34 -0800 Subject: [PATCH] Updated docs --- docs/signals/pctl.md | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/docs/signals/pctl.md b/docs/signals/pctl.md index 833a6ea..b0cde19 100644 --- a/docs/signals/pctl.md +++ b/docs/signals/pctl.md @@ -23,11 +23,10 @@ Here are the signals available: ```lua -- bling::playerctl::status -- first line is the signal -- playing (boolean) -- indented lines are function parameters --- bling::playerctl::album --- album_art (string) --- bling::playerctl::title_artist +-- bling::playerctl::title_artist_album -- title (string) -- artist (string) +-- album_path (string) -- bling::playerctl::position -- interval_sec (number) -- length_sec (number) @@ -45,11 +44,40 @@ local art = wibox.widget { widget = wibox.widget.imagebox } -awesome.connect_signal("bling::playerctl::album", function(path) - art:set_image(gears.surface.load_uncached(path)) +local title_widget = wibox.widget { + markup = 'Nothing Playing', + align = 'center', + valign = 'center', + widget = wibox.widget.textbox +} + +local artist_widget = wibox.widget { + markup = 'Nothing Playing', + align = 'center', + valign = 'center', + widget = wibox.widget.textbox +} + +-- Get Song Info +awesome.connect_signal("bling::playerctl::title_artist_album", + function(title, artist, art_path) + -- Set art widget + art:set_image(gears.surface.load_uncached(art_path)) + + local my_title = "No Title" + local my_artist = "No Artist" + + if title then + my_title = title + my_artist = artist + end + + -- Set title and artist widgets + title_widget:set_markup_silently(my_title) + artist_widget:set_markup_silently(my_artist) end) ``` -Thats all! You don't even have to worry about updating the imagebox, the signals will handle that for you. +Thats all! You don't even have to worry about updating the widgets, the signals will handle that for you. ### Theme Variables ```lua