Control media players with playerctl from media keys and headphones

Run playerctld as a dbus unit with Restart=on-failure, start it through that
unit on D-Bus activation, tie mpris-proxy to it, and bind the XF86 media keys
to playerctl in xmonad.
This commit is contained in:
Daniele Fucini
2026-10-25 19:41:22 +01:00
parent cd439be109
commit 5e8fa266d7
5 changed files with 18 additions and 2 deletions
+5
View File
@@ -137,6 +137,11 @@ myConfig =
`additionalKeys` [ ((0, xF86XK_AudioMute), spawn "pactl set-sink-mute $(pactl get-default-sink) toggle"),
((0, xF86XK_AudioLowerVolume), spawn "pactl set-sink-volume $(pactl get-default-sink) -10%"),
((0, xF86XK_AudioRaiseVolume), spawn "wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 10%+"),
((0, xF86XK_AudioPlay), spawn "playerctl play-pause"),
((0, xF86XK_AudioPause), spawn "playerctl pause"),
((0, xF86XK_AudioStop), spawn "playerctl stop"),
((0, xF86XK_AudioNext), spawn "playerctl next"),
((0, xF86XK_AudioPrev), spawn "playerctl previous"),
((0, xF86XK_Calculator), spawn "qalculate-gtk"),
((0, xF86XK_HomePage), spawn myBrowser),
((0, xF86XK_Mail), namedScratchpadAction myScratchpads "Mail"),