[英]How to do spacing per window on focus with xmonad?
I`m trying to do spacing around window on focus instead of borders.我试图在焦点而不是边框上围绕 window 做间距。 Its much easier to see, what window is focused.
它更容易看到,window 的重点是什么。
XMonad.Actions.Spacing
module does not contain method to make spacing based on window id within this I could do smth like this: XMonad.Actions.Spacing
模块不包含基于 window id 进行间距的方法,我可以这样做:
myHook ConfigureEvent{ev_event_type = focusIn, ev_window = id} = do
setSpacing id opacity
Is there way to do, what I need?有没有办法,我需要什么?
DISCLAIMER : The code below HASN'T BEEN TESTED AND LIKELY IT WONT COMPILE , and even if it compiles, maybe there are good reasons for xmonad
or xmonad-contrib
to not export this functionality since it seems to break the tiling setup... This answer doesn't fit in a comment but it should be consider a advise rather than a solution.免责声明:下面的代码尚未经过测试并且可能无法编译,即使它编译,也许
xmonad
或xmonad-contrib
有充分的理由不导出此功能,因为它似乎破坏了平铺设置......这个答案不适合评论,但应将其视为建议而不是解决方案。
You can copy paste some action code and modify to your will.您可以复制粘贴一些操作代码并根据您的意愿进行修改。 For example mimicking
toggleBorder
from XMonad.Actions.NoBorders
you can get width and heigth attributes and set them to 95% of its original.例如,从
XMonad.Actions.NoBorders
中模仿toggleBorder
,您可以获得宽度和高度属性并将它们设置为原始的 95%。
-- Maybe more inputs are necesary, check for compiler errors
import XMonad
resizeOnFocus :: Window -> X ()
resizeOnFocus w = do
withDisplay $ \d -> io $ do
windowW <- wa_width <$> getWindowAttributes d w
windowH <- wa_height <$> getWindowAttributes d w
let newW = floor $ fromIntegral windowW * 0.95
newH = floor $ fromIntegral windowH * 0.95
resizeWindow d w newW newH
use it with along with withFocused
as a standard action ((modMask x, xK_g ), withFocused resizeOnFocus )
将其与
withFocused
用作标准操作((modMask x, xK_g ), withFocused resizeOnFocus )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.