bindings: add support for multimedia keys with spotify

This commit is contained in:
Vincent Bernat 2012-11-13 21:19:19 +01:00
parent 209bfd8198
commit 56a72c6c47
2 changed files with 12 additions and 1 deletions

View file

@ -98,6 +98,12 @@ local function screen_focus(i)
if c then client.focus = c end if c then client.focus = c end
end end
-- Send a command to spotify
local function spotify(command)
awful.util.spawn("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify " ..
"/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." .. command, false)
end
config.keys.global = awful.util.table.join( config.keys.global = awful.util.table.join(
keydoc.group("Focus"), keydoc.group("Focus"),
awful.key({ modkey, }, "j", awful.key({ modkey, }, "j",
@ -174,6 +180,11 @@ config.keys.global = awful.util.table.join(
awful.key({ }, "XF86AudioRaiseVolume", volume.increase), awful.key({ }, "XF86AudioRaiseVolume", volume.increase),
awful.key({ }, "XF86AudioLowerVolume", volume.decrease), awful.key({ }, "XF86AudioLowerVolume", volume.decrease),
awful.key({ }, "XF86AudioMute", volume.toggle), awful.key({ }, "XF86AudioMute", volume.toggle),
awful.key({ }, "XF86AudioPlay", function() spotify("PlayPause") end),
awful.key({ }, "XF86AudioPause", function() spotify("PlayPause") end),
awful.key({ }, "XF86AudioStop", function() spotify("Stop") end),
awful.key({ }, "XF86AudioNext", function() spotify("Next") end),
awful.key({ }, "XF86AudioPrev", function() spotify("Previous") end),
-- Help -- Help
awful.key({ modkey, }, "F1", keydoc.display) awful.key({ modkey, }, "F1", keydoc.display)

View file

@ -48,7 +48,7 @@ elseif config.hostname == "guybrush" then
execute, { execute, {
-- Keyboard and mouse -- Keyboard and mouse
"setxkbmap us,fr '' compose:ralt ctrl:nocaps grp:rctrl_rshift_toggle", "setxkbmap us,fr '' compose:ralt ctrl:nocaps grp:rctrl_rshift_toggle",
"xmodmap -e 'keysym XF86AudioPlay = XF86ScreenSaver'", "xmodmap -e 'keysym XF86WebCam = XF86ScreenSaver'",
-- Wheel emulation -- Wheel emulation
"xinput set-int-prop 'TPPS/2 IBM TrackPoint' 'Evdev Wheel Emulation' 8 1", "xinput set-int-prop 'TPPS/2 IBM TrackPoint' 'Evdev Wheel Emulation' 8 1",
"xinput set-int-prop 'TPPS/2 IBM TrackPoint' 'Evdev Wheel Emulation Button' 8 2", "xinput set-int-prop 'TPPS/2 IBM TrackPoint' 'Evdev Wheel Emulation Button' 8 2",