From 31d78f87772af4393f9fd663ca6bc2454c89c597 Mon Sep 17 00:00:00 2001 From: David Kosorin Date: Tue, 7 Mar 2023 06:19:41 +0100 Subject: [PATCH] Playerctl lib minor bug fixes (#202) * Fix `get_player_of_name` * Fix `update_on_activity` initialization --- signal/playerctl/playerctl_lib.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/signal/playerctl/playerctl_lib.lua b/signal/playerctl/playerctl_lib.lua index 1df1e1f..ca19633 100644 --- a/signal/playerctl/playerctl_lib.lua +++ b/signal/playerctl/playerctl_lib.lua @@ -170,8 +170,8 @@ function playerctl:get_active_player() end function playerctl:get_player_of_name(name) - for _, player in ipairs(self._private.manager.players[1]) do - if player.name == name then + for _, player in ipairs(self._private.manager.players) do + if player.player_name == name then return player end end @@ -521,8 +521,11 @@ local function new(args) -- Grab settings from beautiful variables if not set explicitly args.ignore = args.ignore or beautiful.playerctl_ignore args.player = args.player or beautiful.playerctl_player - ret.update_on_activity = args.update_on_activity or - beautiful.playerctl_update_on_activity or true + if args.update_on_activity ~= nil then + ret.update_on_activity = args.update_on_activity + else + ret.update_on_activity = beautiful.playerctl_update_on_activity ~= false + end ret.interval = args.interval or beautiful.playerctl_position_update_interval or 1 ret.debounce_delay = args.debounce_delay or beautiful.playerctl_debounce_delay or 0.35 parse_args(ret, args)