20

EDIT: this question/answer is from 2013, back when Awesome was still on version 3.4/3.5, a lot has changed since then as Awesome was rewritten in version 4+ and what you see here may be different now. I'm adding this disclaimer because I'm seeing new responses/views for this question.

I'm trying to map my awesome wm shortcuts similar to tmux. I like tmux's alt+arrow combination to resize the pane in either dimension. I'm aware that awesome's awful.tag.incmwfact() function will work vertically or horizontally depending on layout. However, I'd also like a function that resizes in the other dimension under the same layout as well. This would be useful for maximizing one of the smaller windows vertically without invading the space of the largest window on the other half of the screen:

+----------+----------+
|          |          |
|          |     ^    |
|          +-----|----+
|          |     v    |
|          |          |
+----------+----------+

I found the awful.client.moveresize() function as well, but it only seems to work in floating layout. I know this is doable since I can resize the windows with a mouse, even in tiling layouts. I just don't know which function the mouse hooks into.

Alexander Tsepkov
  • 3,946
  • 3
  • 35
  • 59
  • I wonder if when they rewrote it, that this capability got taken out. I see this Q&A as well as tons of cheatsheets mentioning mod+L and mod+H purportedly providing this functionality. It looks like I've tried everything (btw mod+right mouse drag is also for resizing) and in tiled mode it looks to me like *all tiles* in a tiling layout are *static* in size. Very disappointing. – Steven Lu Jul 02 '18 at 22:02
  • 1
    @StevenLu I could only get `awful.tag.incmwfact` to work on certain layouts (`awful.layout.layouts `). For example, it works with `awful.layout.suit.tile,` and `awful.layout.suit.tile.left,`, but it does not work on `awful.layout.suit.fair,`. I suppose that would make it unfair. ;) – jbrock May 11 '20 at 04:43

4 Answers4

25

Figured it out, posting the answer for others who need this functionality as well:

awful.key({ modkey, "Mod1"    }, "Right",     function () awful.tag.incmwfact( 0.01)    end),
awful.key({ modkey, "Mod1"    }, "Left",     function () awful.tag.incmwfact(-0.01)    end),
awful.key({ modkey, "Mod1"    }, "Down",     function () awful.client.incwfact( 0.01)    end),
awful.key({ modkey, "Mod1"    }, "Up",     function () awful.client.incwfact(-0.01)    end),

Basically, instead of tag's incmwfact, use the client's own incwfact function. Also, this will only work in tiling layouts, in floating it will cause an error bubble.

Alexander Tsepkov
  • 3,946
  • 3
  • 35
  • 59
6

With Awesome version 4, put the following in the clientkeys section of rc.lua.

To move windows with mod+shift+///

awful.key({ modkey, "Shift"   }, "Down",   function (c) c:relative_move(  0,  20,   0,   0) end),
awful.key({ modkey, "Shift"   }, "Up",     function (c) c:relative_move(  0, -20,   0,   0) end),
awful.key({ modkey, "Shift"   }, "Left",   function (c) c:relative_move(-20,   0,   0,   0) end),
awful.key({ modkey, "Shift"   }, "Right",  function (c) c:relative_move( 20,   0,   0,   0) end),

To resize windows with mod+shift+PgUp/PgDn

awful.key({ modkey, "Shift"   }, "Next",   function (c) c:relative_move( 20,  20, -40, -40) end),
awful.key({ modkey, "Shift"   }, "Prior",  function (c) c:relative_move(-20, -20,  40,  40) end),
friederbluemle
  • 33,549
  • 14
  • 108
  • 109
  • the original question asks about window resizing and your answer is about window movement, maybe that would be the reason for the downvote, still a useful answer for me. Thank you!. – deadPoet Oct 17 '18 at 03:44
  • 1
    @deadPoet: True, that could be the reason - however moving and resizing is closely related (it's even the same exact method to call in awesome wm), and half of my answer _is_ about resizing. :) Anyway, thanks for the comment. – friederbluemle Oct 18 '18 at 17:29
  • 2
    With the solution given by you I did solved resizing and moving issues, as OP a suggest a different solution still can't find a good reason to downvote yours. – deadPoet Oct 18 '18 at 18:22
4

Modkey + h or l resizes the tiling.

1

This is an old question but can be helpful for newbies in awesome. To resize windows you can press:

alt + shift + h

or

alt + shift + l