Update README.md

This commit is contained in:
gokul swaminathan 2021-02-16 17:22:00 -08:00 committed by GitHub
parent 601e3286d6
commit cbd9490ead
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 7 deletions

View File

@ -224,11 +224,10 @@ To enable: `bling.signal.playerctl.enable()`
```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)
@ -236,7 +235,6 @@ To enable: `bling.signal.playerctl.enable()`
###### Example Implementation
Lets say we have an imagebox. If I wanted to set the imagebox to show the album art, all I have to do is this:
```lua
local art = wibox.widget {
image = "default_image.png",
@ -246,11 +244,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.