meta: add audio keys support with playerctl

Actually quite useful now that I've figured out how to do this properly.
This commit is contained in:
Donovan Glover 2024-10-11 23:41:20 -04:00
parent 8e5d3c77c7
commit ec3d3899b9
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 17 additions and 0 deletions

View File

@ -99,6 +99,11 @@ in
static const char *mute_vol[] = { "${dunst-scripts}/bin/mv-mute", NULL };
static const char *mute_mic[] = { "${dunst-scripts}/bin/mv-mic", NULL };
static const char *wallpaper[] = { "fish", "${homeDirectory}/.config/${wallpaperScript}", NULL };
static const char *audio_prev[] = { "playerctl", "-p", "playerctld", "previous", NULL };
static const char *audio_next[] = { "playerctl", "-p", "playerctld", "next", NULL };
static const char *audio_play_pause[] = { "playerctl", "-p", "playerctld", "play-pause", NULL };
static const char *audio_forward[] = { "playerctl", "-p", "playerctld", "position", "10+", NULL };
static const char *audio_rewind[] = { "playerctl", "-p", "playerctld", "position", "10-", NULL };
static const Key keys[] = {
{ 0, XF86XK_AudioMute, spawn, {.v = mute_vol } },
@ -107,6 +112,11 @@ in
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = up_vol } },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = dimmer } },
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = brighter } },
{ 0, XF86XK_AudioPrev, spawn, {.v = audio_prev } },
{ 0, XF86XK_AudioNext, spawn, {.v = audio_next } },
{ 0, XF86XK_AudioPlay, spawn, {.v = audio_play_pause } },
{ 0, XF86XK_AudioForward, spawn, {.v = audio_forward } },
{ 0, XF86XK_AudioRewind, spawn, {.v = audio_rewind } },
{ 0, XK_Print, spawn, {.v = print } },
{ MODKEY, XK_bracketleft, spawn, {.v = dmenucmd } },
{ MODKEY, XK_bracketright, spawn, {.v = explorercmd } },

View File

@ -35,6 +35,7 @@ in
lnch
wev
wf-recorder
playerctl
];
wayland.windowManager.hyprland = {
@ -242,6 +243,12 @@ in
", XF86MonBrightnessDown, exec, ${dunst-scripts}/bin/mb-down"
", XF86MonBrightnessUp, exec, ${dunst-scripts}/bin/mb-up"
", XF86Display, exec, ~/.config/${monitorScript}"
", XF86AudioPrev, exec, playerctl -p playerctld previous"
", XF86AudioNext, exec, playerctl -p playerctld next"
", XF86AudioPlay, exec, playerctl -p playerctld play"
", XF86AudioPause, exec, playerctl -p playerctld pause"
", XF86AudioForward, exec, playerctl -p playerctld position 10+"
", XF86AudioRewind, exec, playerctl -p playerctld position 10-"
", XF86Messenger, togglespecialworkspace"
];
};