aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-06-13 21:36:39 +0200
committerTeddy Wing2019-06-15 20:31:18 +0200
commit0ec15de711e01b1686bcdb7209bdc8b5af0e4837 (patch)
treecc27eb5824ad74110ddd6a09f344794dde7eee3e
parent8c50e358f8c0d0103422e78f1ae21d3c0a063843 (diff)
downloadWindowMode.spoon-0ec15de711e01b1686bcdb7209bdc8b5af0e4837.tar.bz2
window: Add shortcut to move window to top
Quickly move a window to the top of the screen.
-rw-r--r--window.lua10
1 files changed, 10 insertions, 0 deletions
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)