Keyboard-Shortcuts
使用 xdotool 和 xbindkeys 的 RapidFire 輸入
我想知道如何配置鍵綁定以使用 RapidFire
xdotool
和遊戲板xbindkeys
輸入?我有一台羅技 F310,我想知道如何在玩遊戲時通過按鍵綁定來模擬 RapidFire 到遊戲搖桿。Linux將此遊戲搖桿註冊為
Generic X-Box pad
設備輸入/dev/input/js0
,借助jstest-gtk
它可以告訴我遊戲搖桿的按鍵映射,如下所示;Axis ABS_X ABS_Y ABS_Z ABS_RX ABS_RY ABS_RZ ABS_HAT0X ABS_HAT0Y Buttons BTN_A BTN_B BTN_X BTN_Y BTN_TL BTN_TR BTN_START BTN_SELECT BTN_MODE BTN_THUMBL BTN_THUMBR
我經常在模擬器上玩遊戲,按鈕映射會有不同的名稱,例如 with
ppsspp
;Dpad UP = pad1.Y HAT- Dpad DWN = pad1.Y HAT+ Dpad LEFT = pad1.X HAT- Dpad RIGHT = pad1.X HAT+ CIRCLE = pad1.DOWN X = pad1.UP SQUARE = pad1.LEFT TRIANGLE = pad1.RIGHT START = pad1.b6 SELECT = pad1.b5 L = pad1.b10 R = pad1.b9 Analogue UP = pad1.Y AXIS- Analogue DWN = pad1.Y AXIS+ Analogue LEFT = pad1.X AXIS- Analogue RIGHT = pad1.X AXIS+
我將如何使用它來映射我想模擬 RapidFire 的鍵綁定?例如,我想為
Y
遊戲搖桿上的按鈕模擬 RapidFire 按下,我將如何映射它被翻譯xbindkeys
,xdotool
以便它自動按下游戲搖桿的按鈕?
好的,所以我對自己進行了一些了解並最終遇到了讓它與我想要的東西一起工作的問題,它可以改進以使其更好,也許是更短的程式碼行?
#!/bin/bash ## RapidFire key modifier for games. ## if you need it to work for something other then ## edit the search parameter name to focus it on that window only. ## You may want to modify the command to include the 'windowactivate' option. winid=$(xdotool search "PPSSPP 1.0.1" | head -n1) while true do # This will spam the console with echo messages. # edit out '| echo' if you want a quiet console. xdotool keydown --window $winid "x" | echo "RapidFire ON" # holding key X down xdotool keyup --window $winid "x" | echo "RapidFire OFF" # release key X up done exit 0 # Press C^ to stop it when done. # # See manpage for 'xdotool' for more options. # http://www.semicomplete.com/projects/xdotool/xdotool.xhtml