Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing Window Vertically

Tags:

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.

like image 461
Alexander Tsepkov Avatar asked Jul 17 '13 16:07

Alexander Tsepkov


People also ask

Can a window be resized?

Right-click on the button that represents the window in Window List . Choose Resize from the Window Menu. Use the arrow keys to resize the window. Press-and-hold Alt, then middle-click near the corner that you want to resize.

How do I manually resize a window in Windows 10?

Press Alt + Space shortcut keys together on the keyboard to open the window menu. Now, press S. The mouse cursor will turn into a cross with arrows. Use the left, right, up and down arrow keys to resize your window.

How do I autofit a window?

Snap Assist is a tool available on Windows 10 that helps you to automatically resize windows to fit the screen side by side perfectly. All you have to do is drag the open windows to the sides or corners and Snap Assist will automatically do the resizing work.


2 Answers

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.

like image 110
Alexander Tsepkov Avatar answered Nov 06 '22 06:11

Alexander Tsepkov


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),
like image 22
friederbluemle Avatar answered Nov 06 '22 04:11

friederbluemle