如何在 xmonad 中设置按键释放时发生的操作?
如何在 xmonad 中设置按键释放时发生的操作?
我不喜欢菜单栏和面板。 我不想使用像 xmobar 这样的面板,而是希望在按住组合键时显示全屏信息页面(时间、当前选择的窗口和工作区等),然后在松开按键时消失。 我可以自己编写信息页面应用程序。 我可以将信息页面设置为在按键时生成。
我无法设置按键释放时发生的任何事情。
如何设置按键释放时发生的操作?
我正在考虑自己扩展 xmonad 来做到这一点。 我希望我不必这样做,因为这真的很烦人。
How can I set an action to occur on a key release in xmonad?
I don't like menu bars and panels.
Instead of a panel like xmobar I want to have a full screen page of info, (time, currently selected window and workspace etc) appear when I hold down a key combo and then vanish when I let the keys go.
I could code the info page application myself.
I can set the info page to spawn on a key press.
I can not set anything to happen on a key release.
How can I set an action to occur on a key release?
I am considering extending xmonad myself to do this.
I hope I don't have to though because it'd be really annoying.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
XMonad 将所有接收到的事件(包括 KeyPress 事件)传递给
handleEventHook
,因此此代码能够对keyRelease
事件做出反应:您可以像在 xmonad 中那样使用它。 hs 文件:
不幸的是,这还不起作用:它只会对在常规
keys
配置中具有相应条目的KeyRelease
事件做出反应。这是由于XMonad.Main
中的grayKeys
仅抓取keys
中提到的键。您可以通过为您想要在 KeyUp 中处理的每个组合定义一个虚拟操作来解决此问题:XMonad passes all received events, including KeyPress events, to the
handleEventHook
, so this code would be able to react onkeyRelease
events:You would use it like that in your xmonad.hs file:
Unfortunately, this does not work yet: It will only react on
KeyRelease
events that have a corresponding entry in the regularkeys
configuration. This is due tograyKeys
inXMonad.Main
, grabbing only keys mentioned inkeys
. You can work-around this by defining a dummy action for every combination that you want to handle inKeyUp
:以上是一个例子。请注意,使用修饰键 (
ev_state
) 可能会发生“按键释放”。The above is an example. Do take note that a 'key release' could occur with a modifier key (
ev_state
).