From 65b77000a65202bb48aa5f12682ea3745ae3d24c Mon Sep 17 00:00:00 2001 From: Alex Denes Date: Thu, 19 Dec 2024 12:22:09 +0000 Subject: [PATCH] Add brightness and volume control and fix missing key for player control --- config.def.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/config.def.h b/config.def.h index c0fb983..b510e90 100644 --- a/config.def.h +++ b/config.def.h @@ -117,6 +117,8 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA #define SHWRAP(cmd) { "/bin/sh", "-c", cmd, NULL } #define TERMWRAP(cmd) { "foot", cmd, NULL } #define PLAYERCTL(cmd) { "playerctl", cmd, NULL } +#define WIREPLUMBERCTL(...) { "wpctl", __VA_ARGS__, NULL } +#define BRIGHTNESSCTL(cmd) { "brightnessctl", cmd, NULL } #define LOCKER "swaylock" /* commands */ @@ -159,10 +161,20 @@ static const Key keys[] = { { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_V, spawn, {.v = audiomixercmd} }, { MODKEY, XKB_KEY_y, spawn, {.v = passmancmd} }, - /* mpv controls */ - { 0, XKB_KEY_XF86AudioPlay, spawn, {.v = PLAYERCTL("play-pause")} }, - { 0, XKB_KEY_XF86AudioPrev, spawn, {.v = PLAYERCTL("previous")} }, - { 0, XKB_KEY_XF86AudioPlay, spawn, {.v = PLAYERCTL("next")} }, + /* media player */ + { 0, XKB_KEY_XF86AudioPlay, spawn, {.v = PLAYERCTL("play-pause")} }, + { 0, XKB_KEY_XF86AudioPrev, spawn, {.v = PLAYERCTL("previous")} }, + { 0, XKB_KEY_XF86AudioNext, spawn, {.v = PLAYERCTL("next")} }, + + /* sound server */ + { 0, XKB_KEY_XF86AudioMute, spawn, {.v = WIREPLUMBERCTL("set-mute", "@DEFAULT_AUDIO_SINK@", "toggle")} }, + { 0, XKB_KEY_XF86AudioMicMute, spawn, {.v = WIREPLUMBERCTL("set-mute", "@DEFAULT_AUDIO_SOURCE@", "toggle")} }, + { 0, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = WIREPLUMBERCTL("set-volume", "@DEFAULT_AUDIO_SINK@", "5%+")} }, + { 0, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = WIREPLUMBERCTL("set-volume", "@DEFAULT_AUDIO_SINK@", "5%-")} }, + + /* misc */ + { 0, XKB_KEY_XF86MonBrightnessUp, spawn, {.v = BRIGHTNESSCTL("set", "5%+")} }, + { 0, XKB_KEY_XF86MonBrightnessDown,spawn, {.v = BRIGHTNESSCTL("set", "5%-")} }, /* window management */ { MODKEY, XKB_KEY_b, togglebar, {0} },