1

How do you deal with function keyboard and with keys:

XF86AudioPlay
XF86AudioPause
XF86AudioPrev
XF86AudioNext 

in awesome wm? I've made shortcuts to raise/lower/mute using the volume buttons in rc.lua

   awful.key({ }, "XF86AudioRaiseVolume", function ()
   awful.util.spawn("amixer set Master 9%+", false) end),
   awful.key({ }, "XF86AudioLowerVolume", function ()
   awful.util.spawn("amixer set Master 9%-", false) end),
   awful.key({ }, "XF86AudioMute", function ()
   awful.util.spawn("amixer set Master toggle", false) end),

I don't have any idea how to the same with Next/Prev/Play buttons. How do you deal with it? I want to use these keys for banshee/spotify.

ryanpattison
  • 6,151
  • 1
  • 21
  • 28
pkruk
  • 809
  • 1
  • 7
  • 24

2 Answers2

4

Ok i hacked this with using dbus (https://wiki.archlinux.org/index.php/Spotify#D-Bus)

   awful.key({ }, "XF86AudioPlay", function () awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause", false) end),
   awful.key({ }, "XF86AudioNext", function () awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next", false) end),
   awful.key({ }, "XF86AudioPrev", function () awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous", false) end),
   awful.key({ }, "XF86AudioStop", function () awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop", false) end),
pkruk
  • 809
  • 1
  • 7
  • 24
1

I two used dbus for it, I made a sh script for making the controls smart

  • Only 1 player can play at the same time, all the others go on pause
  • of no player on my favorite uri starts in a player I defined
  • players have a chosen priority for the play button

here is my script, maybe you can use it: mediakeys.sh

switch87
  • 295
  • 1
  • 18