Skip to content

Commit

Permalink
Define window functions on hs.window metatable
Browse files Browse the repository at this point in the history
Closes #72
  • Loading branch information
jasonrudolph committed Oct 10, 2020
2 parents 3bee475 + 3e0eb1c commit 1839edc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ This setup is honed and tested with the following dependencies.

- macOS High Sierra, 10.13
- [Karabiner-Elements 12.2.0][karabiner]
- [Hammerspoon 0.9.73][hammerspoon]
- [Hammerspoon 0.9.81][hammerspoon]

## Installation

Expand Down
25 changes: 13 additions & 12 deletions hammerspoon/windows.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
hs.window.animationDuration = 0
window = hs.getObjectMetatable("hs.window")

-- +-----------------+
-- | | |
-- | HERE | |
-- | | |
-- +-----------------+
function hs.window.left(win)
function window.left(win)
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
Expand All @@ -22,7 +23,7 @@ end
-- | | HERE |
-- | | |
-- +-----------------+
function hs.window.right(win)
function window.right(win)
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
Expand All @@ -39,7 +40,7 @@ end
-- +-----------------+
-- | |
-- +-----------------+
function hs.window.up(win)
function window.up(win)
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
Expand All @@ -56,7 +57,7 @@ end
-- +-----------------+
-- | HERE |
-- +-----------------+
function hs.window.down(win)
function window.down(win)
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
Expand All @@ -73,7 +74,7 @@ end
-- +--------+ |
-- | |
-- +-----------------+
function hs.window.upLeft(win)
function window.upLeft(win)
local f = win:frame()
local screen = win:screen()
local max = screen:fullFrame()
Expand All @@ -90,7 +91,7 @@ end
-- +--------+ |
-- | HERE | |
-- +-----------------+
function hs.window.downLeft(win)
function window.downLeft(win)
local f = win:frame()
local screen = win:screen()
local max = screen:fullFrame()
Expand All @@ -107,7 +108,7 @@ end
-- | +--------|
-- | | HERE |
-- +-----------------+
function hs.window.downRight(win)
function window.downRight(win)
local f = win:frame()
local screen = win:screen()
local max = screen:fullFrame()
Expand All @@ -125,7 +126,7 @@ end
-- | +--------|
-- | |
-- +-----------------+
function hs.window.upRight(win)
function window.upRight(win)
local f = win:frame()
local screen = win:screen()
local max = screen:fullFrame()
Expand All @@ -142,7 +143,7 @@ end
-- | | HERE | |
-- | | | |
-- +---------------+
function hs.window.centerWithFullHeight(win)
function window.centerWithFullHeight(win)
local f = win:frame()
local screen = win:screen()
local max = screen:fullFrame()
Expand All @@ -159,7 +160,7 @@ end
-- | HERE | |
-- | | |
-- +-----------------+
function hs.window.left40(win)
function window.left40(win)
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
Expand All @@ -176,7 +177,7 @@ end
-- | | HERE |
-- | | |
-- +-----------------+
function hs.window.right60(win)
function window.right60(win)
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
Expand All @@ -188,7 +189,7 @@ function hs.window.right60(win)
win:setFrame(f)
end

function hs.window.nextScreen(win)
function window.nextScreen(win)
local currentScreen = win:screen()
local allScreens = hs.screen.allScreens()
currentScreenIndex = hs.fnutils.indexOf(allScreens, currentScreen)
Expand Down

0 comments on commit 1839edc

Please sign in to comment.