From 0ec15de711e01b1686bcdb7209bdc8b5af0e4837 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 13 Jun 2019 21:36:39 +0200 Subject: window: Add shortcut to move window to top Quickly move a window to the top of the screen. --- window.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'window.lua') diff --git a/window.lua b/window.lua index 42b05ad..3a43d60 100644 --- a/window.lua +++ b/window.lua @@ -115,6 +115,14 @@ function window.decrease_left_med() end +function window.move_to_top() + local position = hs.window.focusedWindow():topLeft() + position.y = 0 + + hs.window.focusedWindow():setTopLeft(position) +end + + window_mode = hs.hotkey.modal.new({'ctrl', 'option', 'shift'}, 'w', 'Window') window_mode:bind({'ctrl', 'option', 'shift'}, 'w', 'Window Off', function() window_mode:exit() @@ -130,6 +138,8 @@ window_mode:bind({}, 'l', window.right_med, nil, window.right_med) window_mode:bind({}, 'j', window.down_med, nil, window.down_med) window_mode:bind({}, 'h', window.left_med, nil, window.left_med) +window_mode:bind({}, 'i', window.move_to_top, nil, window.move_to_top) + window_mode:bind({}, ']', function() hs.window.focusedWindow():moveOneScreenEast(true, false, 0) end) window_mode:bind({}, '[', function() hs.window.focusedWindow():moveOneScreenWest(true, false, 0) end) -- cgit v1.2.3