Skip to content

Commit 1839edc

Browse files
committed
Define window functions on hs.window metatable
Closes #72
2 parents 3bee475 + 3e0eb1c commit 1839edc

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ This setup is honed and tested with the following dependencies.
165165

166166
- macOS High Sierra, 10.13
167167
- [Karabiner-Elements 12.2.0][karabiner]
168-
- [Hammerspoon 0.9.73][hammerspoon]
168+
- [Hammerspoon 0.9.81][hammerspoon]
169169

170170
## Installation
171171

hammerspoon/windows.lua

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
hs.window.animationDuration = 0
2+
window = hs.getObjectMetatable("hs.window")
23

34
-- +-----------------+
45
-- | | |
56
-- | HERE | |
67
-- | | |
78
-- +-----------------+
8-
function hs.window.left(win)
9+
function window.left(win)
910
local f = win:frame()
1011
local screen = win:screen()
1112
local max = screen:frame()
@@ -22,7 +23,7 @@ end
2223
-- | | HERE |
2324
-- | | |
2425
-- +-----------------+
25-
function hs.window.right(win)
26+
function window.right(win)
2627
local f = win:frame()
2728
local screen = win:screen()
2829
local max = screen:frame()
@@ -39,7 +40,7 @@ end
3940
-- +-----------------+
4041
-- | |
4142
-- +-----------------+
42-
function hs.window.up(win)
43+
function window.up(win)
4344
local f = win:frame()
4445
local screen = win:screen()
4546
local max = screen:frame()
@@ -56,7 +57,7 @@ end
5657
-- +-----------------+
5758
-- | HERE |
5859
-- +-----------------+
59-
function hs.window.down(win)
60+
function window.down(win)
6061
local f = win:frame()
6162
local screen = win:screen()
6263
local max = screen:frame()
@@ -73,7 +74,7 @@ end
7374
-- +--------+ |
7475
-- | |
7576
-- +-----------------+
76-
function hs.window.upLeft(win)
77+
function window.upLeft(win)
7778
local f = win:frame()
7879
local screen = win:screen()
7980
local max = screen:fullFrame()
@@ -90,7 +91,7 @@ end
9091
-- +--------+ |
9192
-- | HERE | |
9293
-- +-----------------+
93-
function hs.window.downLeft(win)
94+
function window.downLeft(win)
9495
local f = win:frame()
9596
local screen = win:screen()
9697
local max = screen:fullFrame()
@@ -107,7 +108,7 @@ end
107108
-- | +--------|
108109
-- | | HERE |
109110
-- +-----------------+
110-
function hs.window.downRight(win)
111+
function window.downRight(win)
111112
local f = win:frame()
112113
local screen = win:screen()
113114
local max = screen:fullFrame()
@@ -125,7 +126,7 @@ end
125126
-- | +--------|
126127
-- | |
127128
-- +-----------------+
128-
function hs.window.upRight(win)
129+
function window.upRight(win)
129130
local f = win:frame()
130131
local screen = win:screen()
131132
local max = screen:fullFrame()
@@ -142,7 +143,7 @@ end
142143
-- | | HERE | |
143144
-- | | | |
144145
-- +---------------+
145-
function hs.window.centerWithFullHeight(win)
146+
function window.centerWithFullHeight(win)
146147
local f = win:frame()
147148
local screen = win:screen()
148149
local max = screen:fullFrame()
@@ -159,7 +160,7 @@ end
159160
-- | HERE | |
160161
-- | | |
161162
-- +-----------------+
162-
function hs.window.left40(win)
163+
function window.left40(win)
163164
local f = win:frame()
164165
local screen = win:screen()
165166
local max = screen:frame()
@@ -176,7 +177,7 @@ end
176177
-- | | HERE |
177178
-- | | |
178179
-- +-----------------+
179-
function hs.window.right60(win)
180+
function window.right60(win)
180181
local f = win:frame()
181182
local screen = win:screen()
182183
local max = screen:frame()
@@ -188,7 +189,7 @@ function hs.window.right60(win)
188189
win:setFrame(f)
189190
end
190191

191-
function hs.window.nextScreen(win)
192+
function window.nextScreen(win)
192193
local currentScreen = win:screen()
193194
local allScreens = hs.screen.allScreens()
194195
currentScreenIndex = hs.fnutils.indexOf(allScreens, currentScreen)

0 commit comments

Comments
 (0)