Added a signal
Added the `player_stopped` signal to know when a player has ended.
This commit is contained in:
parent
8338c0100c
commit
352493f475
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue