我不记得我从哪里或如何获得这个脚本,但它运行完美......除了让我无法使用鼠标中键。
;; This configuration is guile based.
;; http://www.gnu.org/software/guile/guile.html
;; 向上滚动 (define (first-binding) "第一个绑定"
(xbindkey-function'("b:2") b3-second-binding) )
(定义(reset-first-binding)“重置第一个绑定”#(ungrab-all-keys)#(remove-all-keys))
(定义(b3-second-binding)“按钮额外功能”(reset-first-binding)
;; Every Trigger
(xbindkey-function '("b:4")
(lambda ()
(reset-first-binding)
(run-command "pactl -- set-sink-volume 0 +5%")
#(run-command "killall xbindkeys; xbindkeys")
)
)
(xbindkey-function '("b:5")
(lambda ()
(reset-first-binding)
(run-command "pactl -- set-sink-volume 0 -5%")
#(run-command "killall xbindkeys; xbindkeys")
)
)
;; Release of key
(xbindkey-function '(release "b:2")
(lambda ()
(reset-first-binding)
#(run-command "xdotool key mouse 2")
(run-command "killall xbindkeys; xbindkeys")
)
)
(首次绑定)
(这样当鼠标 3(鼠标中键)按下并滚动时,音量就会改变)
文件扩展名为 .scm,我不确定这些有什么用。我尝试过改变一些东西,但效果不大。我的目标是拥有绑定和鼠标滚轮按钮。
答案1
看一下这个:https://github.com/mrtgenet/xbindkeys-guile-mouse-altkeys-and-more/blob/main/.xbindkeysrc.scm
注意
(define actionperformed 0)
在文件开头,然后
(set! actionperformed 1)
作为每个秒绑定函数的最后一条指令。
然后 reset-first-binding 函数如下:
(define (reset-first-binding)
"Reset first binding"
(ungrab-all-keys)
(remove-all-keys)
;; Set Action Performed state back to 0
(set! actionperformed 0)
;; Forcefully release all modifier keys!
(run-command "xdotool keyup ctrl keyup alt keyup shift keyup super&")
(first-binding)
(grab-all-keys)
)
这可能不是完整的解决方案,但我希望这会有所帮助:)