2021-04-24 11:37:06 +02:00
|
|
|
local beautiful = require("beautiful")
|
|
|
|
|
|
|
|
-- Use CLI backend as default as it is supported on most if not all systems
|
|
|
|
local backend_config = beautiful.playerctl_backend or "playerctl_cli"
|
|
|
|
local backends = {
|
|
|
|
playerctl_cli = require(... .. ".playerctl_cli"),
|
2021-08-27 20:01:22 +02:00
|
|
|
playerctl_lib = require(... .. ".playerctl_lib"),
|
2021-04-24 11:37:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
local function enable_wrapper(args)
|
|
|
|
backend_config = (args and args.backend) or backend_config
|
|
|
|
backends[backend_config].enable(args)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function disable_wrapper()
|
|
|
|
backends[backend_config].disable()
|
|
|
|
end
|
|
|
|
|
2021-08-27 20:01:22 +02:00
|
|
|
return { enable = enable_wrapper, disable = disable_wrapper }
|