简体   繁体   English

如何通过键绑定在 Xmonad Window 上运行挂钩

[英]How to run a hook on a Xmonad Window via keybinding

I am looking for a way to replicate the behaviour of doCenterFloat in my managehook to a keybinding.我正在寻找一种将我的doCenterFloat中doCenterFloat 的行为复制到键绑定的方法。 I would like to keep the windows 'natural' size.我想保持 windows 的“自然”尺寸。 For example, when i create an OpenGL window with size 800x600, I would manually have to add the title of the window to my XMonad config, otherwise it would be tiled and the contents of the window would be stretched. For example, when i create an OpenGL window with size 800x600, I would manually have to add the title of the window to my XMonad config, otherwise it would be tiled and the contents of the window would be stretched.

Here is the code i am trying to replicate to a key binding这是我试图复制到键绑定的代码

myManageHook = composeAll
     [ title =? "OpenGL"              --> doCenterFloat ]

The above code makes the window display correctly.上述代码使 window 正确显示。 I have tried functions that toggle a normal float (not centerFloat) but they display at the tiled sized, like this Xmonad: Float and resize windows to its “natural size我已经尝试过切换普通浮点数(不是 centerFloat)的函数,但它们以平铺大小显示,例如Xmonad:Float and resize windows to its “natural size

Any help is much appreciated任何帮助深表感谢

runQuery :: Query a -> Window -> X a

http://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Config-Prime.html#v:runQuery http://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Config-Prime.html#v:runQuery

withFocused :: (Window -> X ()) -> X ()

http://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Config-Prime.html#v:withFocused http://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Config-Prime.html#v:withFocused

Using the above two functions, where myQuery would be set your your Query (like doCenterFloat ).使用上述两个函数,其中myQuery将设置您的Query (如doCenterFloat )。

myQuery = undefined :: Query
withFocused (\window -> runQuery myQuery window)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM