5

To have a window placed on the floating layer as soon as it appears, one can use the doFloat function from ManageHooks. In addition there are some additional functions, like doCenterFloat for instance, that are provided by 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. In the description for doRectFloat it states the following:

The rectangle to float the window in. 0 to 1; x, y, w, h.

But I don't know how to use this.

duplode
  • 33,731
  • 7
  • 79
  • 150
drumfire
  • 943
  • 7
  • 19

1 Answers1

3

ManageHelpers does have a function called doRectFloat [...] But I don't know how to use this.

The type of doRectFloat is...

doRectFloat :: RationalRect -> ManageHook

... so you need to pass it a RationalRect (following the links in the docs usually helps in figuring out such things):

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. To use it, you will need to add import Data.Ratio to the imports at the top of your xmonad.hs file.

duplode
  • 33,731
  • 7
  • 79
  • 150
  • 1
    Ah yes. At first it did make the window a floating window, but the size and position were not adjusted. As it turned out, this had to do with `placeHook simpleSmart` from `XMonad.Hooks.Place`. As soon as I disabled that one, your solution worked. Thank you. – drumfire Feb 23 '18 at 22:17
  • For the curious reader - I am using the `composeOne` ManageHook composer, rather than the more frequently used `composeAll`. The former stops as soon as there is a match. This explains why it didn't originally work, and instead of disabling `placeHook simpleSmart`, I have now placed it after the list of individual windows I want to be floating. – drumfire Feb 23 '18 at 22:36