重新映射 ubuntu 中的“下一首歌曲”键以与 Spotify 和 wine 配合使用

Dan*_*son 7 keyboard spotify keymap ubuntu

我想在 ubuntu 中使用全局键更改 Spotify 中的歌曲。这在 Windows 上是可能的,键盘上有一个特殊的键,“下一首歌曲键”(?)

如何重新映射 ubuntu 中的键(此处没有“下一首歌曲”按钮)以用作“下一首歌曲”按钮?比如“ctrl+右键”。

我将如何使用通过 Wine 运行的 Spotify 来完成这项工作?

基本上我想知道“下一首歌曲”按钮的 ascii 代码是什么,以及如何将它映射到 ubuntu 下的组合键。并希望它通过 wine 毫无问题地路由这个命令。

编辑:我在 ubuntu 机器上没有“下一首歌曲”按钮。

小智 7

或者jbonney在他的要点上使用 dbus-send 找到了一个非常巧妙的解决方案

或者,如果您赶时间:

"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious
Run Code Online (Sandbox Code Playgroud)


qua*_*ote 1

使用xev(X 事件查看器)确定按下该键时发送的键码。然后,您可以在您使用的任何系统(Gnome、KDE、裸 X 等)的键映射实用程序中重新映射键。

在我的 Debian 系统上,xev它是随x11-utils软件包一起安装的,因此它可能包含在典型的 Ubuntu 桌面安装中。

使用示例:

$ xev
[example keypress: right option key on an apple USB keyboard]

KeyPress event, serial 33, synthetic NO, window 0x1200001,
    root 0x2e, subw 0x0, time 122600873, (-49,299), root:(679,325),
    state 0x0, keycode 255 (keysym 0xffec, Super_R), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x1200001,
    root 0x2e, subw 0x0, time 122600971, (-49,299), root:(679,325),
    state 0x0, keycode 255 (keysym 0xffec, Super_R), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False
Run Code Online (Sandbox Code Playgroud)