UlfR
UlfR

Reputation: 4395

What is incwfact and setwfact of awesome.client

I have been using awesome for some years and like it alot. I'm regularly using Super+h and Super+l to change with of master.

But I would like to be able to change the hight of the active client (master or non-master) if ther is several in the same column. I can do this with the mouse but would like to connect some shortcut-key to it.

I think incwfact and setwfact is the way to go, but I don't understand how its working or how I should use it.

So say I have the following setup and the currently focused window is 3:

+------+-------+
|   1  |   2   |
|      |       |
|      +-------+
|      |  (3)  |
+------+-------+

Now I would like to hit shortcut Super-j (I know this is the default for focus-next, but I'm ok with changing that) and have 3 grow some. So the new layout would be:

+------+-------+
|   1  |   2   |
|      +-------+
|      |  (3)  |
|      |       |
+------+-------+

Questions:

Upvotes: 1

Views: 531

Answers (1)

Uli Schlachter
Uli Schlachter

Reputation: 9867

There is this wfact-thing that can be set and inc(reased), but what is it?

wfact is short for window factor. Each window gets a fraction of the available space. The idea is that a window with a window factor of 0.4 gets 40% of the available space.

How can this be done?

I would just copy the bindings in the default config for Mod4+l and Mod4+h. These change the master window factor (mwfact). Change the code to call awful.client.incwfact instead of awful.tag.incmwfact.

Are there any pitfalls?

Personally, I consider this window factor business quite non-intuitive. Besides that... dunno.

Is this functionality already in the default default behaviour?

A quick look at the result of Mod4+S did not find anything. I guess "no".

Am I trying to solve the wrong thing?

I don't know. Well, let's try this from another angle:

But I would like to be able to change the hight of the active client (master or non-master) if ther is several in the same column. I can do this with the mouse but would like to connect some shortcut-key to it.

From a quick look at awful.layout.suit.tile: The mouse-resize code computes some numbers based on math that I do not understand immediately. At the end of the calculations, it does the following to save its calculations:

c.screen.selected_tag.master_width_factor
  = math.min(math.max(new_mwfact, 0.01), 0.99)
client.setwfact(math.min(math.max(wfact,0.01), 0.99), c)

Thus, everything that can be done with mouse-resizing should also be doable by changing the master width factor and the window factor.

Upvotes: 2

Related Questions