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:
@@ -1,2 +0,0 @@
|
||||
[Unit]
|
||||
After=mpd-mpris.service
|
||||
@@ -0,0 +1,4 @@
|
||||
[Unit]
|
||||
Wants=playerctld.service
|
||||
After=playerctld.service mpDris2.service
|
||||
PartOf=playerctld.service
|
||||
@@ -0,0 +1,5 @@
|
||||
[Service]
|
||||
Type=dbus
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/playerctld
|
||||
Restart=on-failure
|
||||
@@ -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"),
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
[D-BUS Service]
|
||||
Name=org.mpris.MediaPlayer2.playerctld
|
||||
Exec=/usr/bin/playerctld
|
||||
SystemdService=playerctld.service
|
||||
Reference in New Issue
Block a user