Add brightness and volume control and fix missing key for player control

This commit is contained in:
Alex D. 2024-12-19 12:22:09 +00:00
parent e4a2a5250c
commit 76fda1cb27
Signed by: caskd
GPG Key ID: F92BA85F61F4C173

View File

@ -116,7 +116,9 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHWRAP(cmd) { "/bin/sh", "-c", cmd, NULL }
#define TERMWRAP(cmd) { "foot", cmd, NULL }
#define PLAYERCTL(cmd) { "playerctl", cmd, NULL }
#define PLAYERCTL(...) { "playerctl", __VA_ARGS__, NULL }
#define WIREPLUMBERCTL(...) { "wpctl", __VA_ARGS__, NULL }
#define BRIGHTNESSCTL(...) { "brightnessctl", __VA_ARGS__, NULL }
#define LOCKER "swaylock"
/* commands */
@ -159,13 +161,22 @@ 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} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J, pushdown, {0} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },