diff options
author | Teddy Wing | 2019-07-06 19:03:07 +0200 |
---|---|---|
committer | Teddy Wing | 2019-07-06 19:04:28 +0200 |
commit | dbd3334df48a568cd932e1ef6dd62dea102177d5 (patch) | |
tree | fa17511977faae392400b1b9f217ea58c3fb46d4 | |
parent | 8ad090ae8d4d77f25d49c092ffefb5c8d7444007 (diff) | |
download | WindowMode.spoon-master.tar.bz2 |
A single shortcut to extend the window to the bottom of the screen.
-rw-r--r-- | README.rst | 4 | ||||
-rw-r--r-- | docs.json | 48 | ||||
-rw-r--r-- | init.lua | 2 | ||||
-rw-r--r-- | window.lua | 13 |
4 files changed, 43 insertions, 24 deletions
@@ -75,6 +75,10 @@ Upon activating the mode, the following shortcuts are available: | ``Option-f`` | Increase window width 5 units | +--------------+--------------------------------+ ++-------+----------------------------------+ +| ``c`` | Increase window height to bottom | ++-------+----------------------------------+ + Install ------- @@ -23,15 +23,19 @@ "Constructor" : [ ], - "items" : [ + "doc" : "Adds a hotkey mode for manipulating windows.\n\nUpon activating the mode, the following shortcuts are available:\n\nh: Move window left 100 units\nj: Move window down 100 units\nk: Move window up 100 units\nl: Move window right 100 units\n\nShift-h: Move window left 20 units\nShift-j: Move window down 20 units\nShift-k: Move window up 20 units\nShift-l: Move window right 20 units\n\nOption-h: Move window left 5 units\nOption-j: Move window down 5 units\nOption-k: Move window up 5 units\nOption-l: Move window right 5 units\n\ni: Move window to top\n\n[: Move window left one screen\n]: Move window right one screen\n\ne: Reduce window height 100 units\ns: Reduce window width 100 units\nd: Increase window height 100 units\nf: Increase window width 100 units\n\nShift-e: Reduce window height 20 units\nShift-s: Reduce window width 20 units\nShift-d: Increase window height 20 units\nShift-f: Increase window width 20 units\n\nOption-e: Reduce window height 5 units\nOption-s: Reduce window width 5 units\nOption-d: Increase window height 5 units\nOption-f: Increase window width 5 units\n\nc: Increase window height to bottom", + "Method" : [ { - "desc" : "Bind keys for WindowMode", + "doc" : "Bind keys for WindowMode\n\nParameters:\n * mapping – A table containing hotkey modifier\/key details for the following items:\n * mode – Activate and deactivate window mode", + "def" : "WindowMode:bindModal(mapping)", "stripped_doc" : [ "Bind keys for WindowMode", "" ], - "def" : "WindowMode:bindModal(mapping)", - "doc" : "Bind keys for WindowMode\n\nParameters:\n * mapping – A table containing hotkey modifier\/key details for the following items:\n * mode – Activate and deactivate window mode", + "parameters" : [ + " * mapping – A table containing hotkey modifier\/key details for the following items:", + " * mode – Activate and deactivate window mode" + ], "notes" : [ ], @@ -41,21 +45,27 @@ ], "name" : "bindModal", - "parameters" : [ - " * mapping – A table containing hotkey modifier\/key details for the following items:", - " * mode – Activate and deactivate window mode" - ] + "desc" : "Bind keys for WindowMode" } ], - "Method" : [ + "Command" : [ + + ], + "Field" : [ + + ], + "items" : [ { - "desc" : "Bind keys for WindowMode", + "doc" : "Bind keys for WindowMode\n\nParameters:\n * mapping – A table containing hotkey modifier\/key details for the following items:\n * mode – Activate and deactivate window mode", + "def" : "WindowMode:bindModal(mapping)", "stripped_doc" : [ "Bind keys for WindowMode", "" ], - "def" : "WindowMode:bindModal(mapping)", - "doc" : "Bind keys for WindowMode\n\nParameters:\n * mapping – A table containing hotkey modifier\/key details for the following items:\n * mode – Activate and deactivate window mode", + "parameters" : [ + " * mapping – A table containing hotkey modifier\/key details for the following items:", + " * mode – Activate and deactivate window mode" + ], "notes" : [ ], @@ -65,19 +75,9 @@ ], "name" : "bindModal", - "parameters" : [ - " * mapping – A table containing hotkey modifier\/key details for the following items:", - " * mode – Activate and deactivate window mode" - ] + "desc" : "Bind keys for WindowMode" } ], - "Command" : [ - - ], - "Field" : [ - - ], - "doc" : "Adds a hotkey mode for manipulating windows.\n\nUpon activating the mode, the following shortcuts are available:\n\nh: Move window left 100 units\nj: Move window down 100 units\nk: Move window up 100 units\nl: Move window right 100 units\n\nShift-h: Move window left 20 units\nShift-j: Move window down 20 units\nShift-k: Move window up 20 units\nShift-l: Move window right 20 units\n\nOption-h: Move window left 5 units\nOption-j: Move window down 5 units\nOption-k: Move window up 5 units\nOption-l: Move window right 5 units\n\ni: Move window to top\n\n[: Move window left one screen\n]: Move window right one screen\n\ne: Reduce window height 100 units\ns: Reduce window width 100 units\nd: Increase window height 100 units\nf: Increase window width 100 units\n\nShift-e: Reduce window height 20 units\nShift-s: Reduce window width 20 units\nShift-d: Increase window height 20 units\nShift-f: Increase window width 20 units\n\nOption-e: Reduce window height 5 units\nOption-s: Reduce window width 5 units\nOption-d: Increase window height 5 units\nOption-f: Increase window width 5 units", "name" : "WindowMode" } -]
\ No newline at end of file +] @@ -38,6 +38,8 @@ --- Option-s: Reduce window width 5 units --- Option-d: Increase window height 5 units --- Option-f: Increase window width 5 units +--- +--- c: Increase window height to bottom -- Copyright (c) 2019 Teddy Wing -- @@ -48,6 +48,8 @@ local units = { decrease_up_lg = { w = 0, h = -100 }, decrease_left_lg = { w = -100, h = 0 }, + increase_down_maximum = { w = 0, h = 1.0 }, + maximum = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 } } @@ -181,6 +183,15 @@ function window.decrease_left_lg() ) end +function window.increase_down_maximum() + local duration = 0 + local window = hs.window.focusedWindow() + local frame = window:frame() + frame.h = hs.screen.mainScreen():frame().h + + window:setFrame(frame, duration) +end + function window.move_to_top() local position = hs.window.focusedWindow():topLeft() @@ -230,6 +241,8 @@ function window:bindModal(modifiers, keycode) 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) + + window_mode:bind({}, 'c', window.increase_down_maximum, nil, window.increase_down_maximum) end return window |