diff options
author | Teddy Wing | 2019-07-03 20:31:37 +0200 |
---|---|---|
committer | Teddy Wing | 2019-07-03 20:35:00 +0200 |
commit | 9f62ebd52b7aa745764b81ae562478f4c3537947 (patch) | |
tree | bc41f8c2e22359fc6cd11b917ce7623a41cfd267 | |
parent | 4f3f75e1c926e1ad619b2b24d1a7f0459cf20e7e (diff) | |
download | WindowMode.spoon-9f62ebd52b7aa745764b81ae562478f4c3537947.tar.bz2 |
window.lua: Add large increment window resize hotkeys
Change the modifiers to match the window movement hotkeys.
-rw-r--r-- | README.rst | 48 | ||||
-rw-r--r-- | init.lua | 21 | ||||
-rw-r--r-- | window.lua | 51 |
3 files changed, 85 insertions, 35 deletions
@@ -45,25 +45,35 @@ Upon activating the mode, the following shortcuts are available: | ``]`` | Move window right one screen | +-------+------------------------------+ -+-------+---------------------------------+ -| ``e`` | Reduce window height 20 units | -+-------+---------------------------------+ -| ``s`` | Reduce window width 20 units | -+-------+---------------------------------+ -| ``d`` | Increase window height 20 units | -+-------+---------------------------------+ -| ``f`` | Increase window width 20 units | -+-------+---------------------------------+ - -+-------------+--------------------------------+ -| ``Shift-e`` | Reduce window height 5 units | -+-------------+--------------------------------+ -| ``Shift-s`` | Reduce window width 5 units | -+-------------+--------------------------------+ -| ``Shift-d`` | Increase window height 5 units | -+-------------+--------------------------------+ -| ``Shift-f`` | Increase window width 5 units | -+-------------+--------------------------------+ ++-------+----------------------------------+ +| ``e`` | Reduce window height 100 units | ++-------+----------------------------------+ +| ``s`` | Reduce window width 100 units | ++-------+----------------------------------+ +| ``d`` | Increase window height 100 units | ++-------+----------------------------------+ +| ``f`` | Increase window width 100 units | ++-------+----------------------------------+ + ++-------------+---------------------------------+ +| ``Shift-e`` | Reduce window height 20 units | ++-------------+---------------------------------+ +| ``Shift-s`` | Reduce window width 20 units | ++-------------+---------------------------------+ +| ``Shift-d`` | Increase window height 20 units | ++-------------+---------------------------------+ +| ``Shift-f`` | Increase window width 20 units | ++-------------+---------------------------------+ + ++--------------+--------------------------------+ +| ``Option-e`` | Reduce window height 5 units | ++--------------+--------------------------------+ +| ``Option-s`` | Reduce window width 5 units | ++--------------+--------------------------------+ +| ``Option-d`` | Increase window height 5 units | ++--------------+--------------------------------+ +| ``Option-f`` | Increase window width 5 units | ++--------------+--------------------------------+ Install @@ -24,15 +24,20 @@ --- [: Move window left one screen --- ]: Move window right one screen --- ---- e: Reduce window height 20 units ---- s: Reduce window width 20 units ---- d: Increase window height 20 units ---- f: Increase window width 20 units +--- e: Reduce window height 100 units +--- s: Reduce window width 100 units +--- d: Increase window height 100 units +--- f: Increase window width 100 units --- ---- Shift-e: Reduce window height 5 units ---- Shift-s: Reduce window width 5 units ---- Shift-d: Increase window height 5 units ---- Shift-f: Increase window width 5 units +--- Shift-e: Reduce window height 20 units +--- Shift-s: Reduce window width 20 units +--- Shift-d: Increase window height 20 units +--- Shift-f: Increase window width 20 units +--- +--- Option-e: Reduce window height 5 units +--- Option-s: Reduce window width 5 units +--- Option-d: Increase window height 5 units +--- Option-f: Increase window width 5 units -- Copyright (c) 2019 Teddy Wing -- @@ -42,6 +42,12 @@ local units = { decrease_up_med = { w = 0, h = -20 }, decrease_left_med = { w = -20, h = 0 }, + increase_right_lg = { w = 100, h = 0 }, + increase_down_lg = { w = 0, h = 100 }, + + decrease_up_lg = { w = 0, h = -100 }, + decrease_left_lg = { w = -100, h = 0 }, + maximum = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 } } @@ -151,6 +157,30 @@ function window.decrease_left_med() ) end +function window.increase_right_lg() + hs.window.focusedWindow():setSize( + window.relative_size(hs.window.focusedWindow(), units.increase_right_lg) + ) +end + +function window.increase_down_lg() + hs.window.focusedWindow():setSize( + window.relative_size(hs.window.focusedWindow(), units.increase_down_lg) + ) +end + +function window.decrease_up_lg() + hs.window.focusedWindow():setSize( + window.relative_size(hs.window.focusedWindow(), units.decrease_up_lg) + ) +end + +function window.decrease_left_lg() + hs.window.focusedWindow():setSize( + window.relative_size(hs.window.focusedWindow(), units.decrease_left_lg) + ) +end + function window.move_to_top() local position = hs.window.focusedWindow():topLeft() @@ -186,15 +216,20 @@ function window:bindModal(modifiers, keycode) window_mode:bind({}, ']', function() hs.window.focusedWindow():moveOneScreenEast(true, false, 0) end) window_mode:bind({}, '[', function() hs.window.focusedWindow():moveOneScreenWest(true, false, 0) end) - window_mode:bind({'shift'}, 'e', window.decrease_up, nil, window.decrease_up) - window_mode:bind({'shift'}, 'd', window.increase_down, nil, window.increase_down) - window_mode:bind({'shift'}, 'f', window.increase_right, nil, window.increase_right) - window_mode:bind({'shift'}, 's', window.decrease_left, nil, window.decrease_left) + window_mode:bind({'option'}, 'e', window.decrease_up, nil, window.decrease_up) + window_mode:bind({'option'}, 'd', window.increase_down, nil, window.increase_down) + window_mode:bind({'option'}, 'f', window.increase_right, nil, window.increase_right) + window_mode:bind({'option'}, 's', window.decrease_left, nil, window.decrease_left) + + window_mode:bind({'shift'}, 'e', window.decrease_up_med, nil, window.decrease_up_med) + window_mode:bind({'shift'}, 'd', window.increase_down_med, nil, window.increase_down_med) + window_mode:bind({'shift'}, 'f', window.increase_right_med, nil, window.increase_right_med) + window_mode:bind({'shift'}, 's', window.decrease_left_med, nil, window.decrease_left_med) - window_mode:bind({}, 'e', window.decrease_up_med, nil, window.decrease_up_med) - window_mode:bind({}, 'd', window.increase_down_med, nil, window.increase_down_med) - window_mode:bind({}, 'f', window.increase_right_med, nil, window.increase_right_med) - window_mode:bind({}, 's', window.decrease_left_med, nil, window.decrease_left_med) + window_mode:bind({}, 'e', window.decrease_up_lg, nil, window.decrease_up_lg) + window_mode:bind({}, 'd', window.increase_down_lg, nil, window.increase_down_lg) + window_mode:bind({}, 'f', window.increase_right_lg, nil, window.increase_right_lg) + window_mode:bind({}, 's', window.decrease_left_lg, nil, window.decrease_left_lg) end return window |