aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2019-06-13 21:36:39 +0200
committerTeddy Wing2019-06-15 20:31:18 +0200
commite3bc1d3782f82ff2ed3addf7e0ad3cf08afc1694 (patch)
tree78d19edd7e9d56a22a88b940e412f67758fc0ccc
parentec4092a454cbacf4083115b8592d9909ce06b33e (diff)
downloaddothammerspoon-e3bc1d3782f82ff2ed3addf7e0ad3cf08afc1694.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)