From a29cf9e2b6b75cdd384dfa45f0e5394c52f2d68a Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 2 Oct 2020 18:38:44 +0200 Subject: [PATCH] Support disabling volume control --- simple/media_control.lua | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/simple/media_control.lua b/simple/media_control.lua index 589c33a..cda3799 100644 --- a/simple/media_control.lua +++ b/simple/media_control.lua @@ -192,22 +192,33 @@ local toggleMute = function() end -- }}} -function getKeys(config) +function getKeys(keys) + if config.audio.card == 'disabled' then + return + -- Media control + hotkey.make(keys.playPause, playPause, + { description = "Toggle Play / Pause", group = "media control" }), + hotkey.make(keys.nextTrack, nextTrack, + { description = "Next track", group = "media control" }), + hotkey.make(keys.previousTrack, previousTrack, + { description = "Previous track", group = "media control" }) + end + return -- Volume control - hotkey.make(config.raiseVolume, raiseVolume, + hotkey.make(keys.raiseVolume, raiseVolume, { description = "Raise volume", group = "media control" }), - hotkey.make(config.lowerVolume, lowerVolume, + hotkey.make(keys.lowerVolume, lowerVolume, { description = "Lower volume", group = "media control" }), - hotkey.make(config.toggleMute, toggleMute, + hotkey.make(keys.toggleMute, toggleMute, { description = "Toggle mute audio", group = "media control" }), -- Media control - hotkey.make(config.playPause, playPause, + hotkey.make(keys.playPause, playPause, { description = "Toggle Play / Pause", group = "media control" }), - hotkey.make(config.nextTrack, nextTrack, + hotkey.make(keys.nextTrack, nextTrack, { description = "Next track", group = "media control" }), - hotkey.make(config.previousTrack, previousTrack, + hotkey.make(keys.previousTrack, previousTrack, { description = "Previous track", group = "media control" }) end