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 6f6e5fb6fd
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 */
@ -134,6 +136,18 @@ static const char *screenshotcmd[] = SHWRAP("wayshot -s \"$(slurp)\" --file /tmp
static const char *audiomixercmd[] = TERMWRAP("pulsemixer");
static const char *passmancmd[] = SHWRAP("~/Sources/Scripts/bemenu/passman/script.zsh");
static const char *playcmd[] = PLAYERCTL("play-pause");
static const char *prevtrackcmd[] = PLAYERCTL("previous");
static const char *nexttrackcmd[] = PLAYERCTL("next");
static const char *muteoutcmd[] = WIREPLUMBERCTL("set-mute", "@DEFAULT_AUDIO_SINK@", "toggle");
static const char *muteincmd[] = WIREPLUMBERCTL("set-mute", "@DEFAULT_AUDIO_SOURCE@", "toggle");
static const char *volupcmd[] = WIREPLUMBERCTL("set-volume", "@DEFAULT_AUDIO_SINK@", "5%+");
static const char *voldowncmd[] = WIREPLUMBERCTL("set-volume", "@DEFAULT_AUDIO_SINK@", "5%-");
static const char *brightupcmd[] = BRIGHTNESSCTL("set", "5%+");
static const char *brightdowncmd[] = BRIGHTNESSCTL("set", "5%-");
/* Autostart */
// Note: This is intended to store the env under /run/user/$UID/session-0/ for the user tree to use in starting other services that are independently supervised
// This also notifies the parent via fd 3 when it's ready
@ -159,13 +173,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 = playcmd} },
{ 0, XKB_KEY_XF86AudioPrev, spawn, {.v = prevtrackcmd} },
{ 0, XKB_KEY_XF86AudioNext, spawn, {.v = nexttrackcmd} },
/* sound server */
{ 0, XKB_KEY_XF86AudioMute, spawn, {.v = muteoutcmd} },
{ 0, XKB_KEY_XF86AudioMicMute, spawn, {.v = muteincmd} },
{ 0, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = volupcmd} },
{ 0, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = voldowncmd} },
/* misc */
{ 0, XKB_KEY_XF86MonBrightnessUp, spawn, {.v = brightupcmd} },
{ 0, XKB_KEY_XF86MonBrightnessDown,spawn, {.v = brightdowncmd} },
/* 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} },