区分蓝牙键和键盘键

Distinguish between Bluetooth- and Keyboard Key

我有一个可以通过蓝牙连接到我的计算机的按钮。但是,它模拟音量增大按钮,我想区分蓝牙按钮和 "real" 键盘音量增大按钮。

我已经使用 xev 查看了这两个键。它们看起来像这样:

键盘音量增大按钮

  KeyPress event, serial 34, synthetic NO, window 0x1800001,
    root 0x14e, subw 0x0, time 2849770, (-88,658), root:(876,680),
    state 0x1, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

蓝牙按钮

  KeyPress event, serial 34, synthetic NO, window 0x1800001,
    root 0x14e, subw 0x0, time 2858907, (-88,658), root:(876,680),
    state 0x1, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

我通过 Arch Linux 上的 bluetoothctl 连接了蓝牙按钮。

现在我想在我的 ~/.config/i3/config 中添加类似

的东西
bindcode 123 exec "~/doStuff.sh"

但是,这确实改变了我的键盘按钮和蓝牙按钮。但我想添加一些东西来改变蓝牙按钮,而不是键盘按钮。

经过大量研究,我找到了 ruby gem bluebutton (https://github.com/kinnalru/bluebutton)。在那里,我可以定义我在蓝牙按钮 xinput list 中找到的名称,并添加要在配置中执行的命令。