简体   繁体   English

xmonad:浮动窗口的默认大小

[英]xmonad: default size for a floating window

To have a window placed on the floating layer as soon as it appears, one can use the doFloat function from ManageHooks . 有一旦它出现置于浮置层上的窗口,一个可使用doFloat从功能ManageHooks In addition there are some additional functions, like doCenterFloat for instance, that are provided by ManageHelpers . 此外,还有一些额外的功能,如doCenterFloat例如,通过提供的ManageHelpers

But is there any way to specify a specific size for a window? 但是,有什么方法可以指定窗口的特定大小吗?

Right now I have an application and it just takes the whole window space. 现在我有一个应用程序,它只占用整个窗口空间。 I'd like to specify a more comfortable size. 我想指定一个更舒适的尺寸。

ManageHelpers does have a function called doRectFloat which takes a RationalRect . ManageHelpers确实具有一个名为doRectFloat的函数,该函数采用RationalRect In the description for doRectFloat it states the following: doRectFloat描述中,它指出以下内容:

The rectangle to float the window in. 0 to 1; 浮动窗口的矩形。0到1;否则为0。 x, y, w, h. x,y,w,h

But I don't know how to use this. 但我不知道该如何使用。

ManageHelpers does have a function called doRectFloat [...] But I don't know how to use this. ManageHelpers确实有一个名为doRectFloat的函数,但是我不知道如何使用它。

The type of doRectFloat is... doRectFloat的类型是...

doRectFloat :: RationalRect -> ManageHook

... so you need to pass it a RationalRect (following the links in the docs usually helps in figuring out such things): ...因此您需要向其传递一个RationalRect (遵循文档中的链接通常有助于弄清此类情况):

doRectFloat (RationalRect (1 % 4) (1 % 4) (1 % 2) (1 % 2))

This should produce a centered rectangle with half of the full width and length. 这将产生一个居中的矩形,其宽度和长度为一半。 % is used to build Rational (a type for exact fractions) values. %用于构建Rational (精确分数的类型)值。 To use it, you will need to add import Data.Ratio to the imports at the top of your xmonad.hs file. 要使用它,您需要将import Data.Ratio添加到xmonad.hs文件顶部的xmonad.hs

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

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