-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
51 lines (43 loc) · 1.6 KB
/
init.lua
File metadata and controls
51 lines (43 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
hs.window.animationDuration = 0
local HotTerm = {}
local terminalApp = "Kitty"
local screenHeight = 350
HotTerm.__index = HotTerm
local function transformWindow(appWindow)
local screenFrame = hs.screen.mainScreen():frame()
appWindow:setFrame(hs.geometry.rect(screenFrame.x, screenFrame.y, screenFrame.w, screenFrame.h - screenHeight), 0)
end
local function showHotWindow(app)
local currentSpace = hs.spaces.activeSpaceOnScreen()
local appWindow = app:mainWindow()
hs.spaces.moveWindowToSpace(appWindow, currentSpace)
appWindow:focus()
return appWindow
end
local function toggleTerminal()
local app = hs.application.get(terminalApp)
if app and app:isFrontmost() then
app:hide()
return
end
-- local currentScreen = hs.screen.mainScreen()
-- local screenUUID = currentScreen:getUUID()
-- local allSpaces = hs.spaces.allSpaces()
-- local allSpacesForScreen = allSpaces[screenUUID]
-- local currentSpace = hs.spaces.activeSpaceOnScreen()
-- local appWindow = app:mainWindow()
-- local windowSpaces = hs.spaces.windowSpaces(appWindow)
-- hs.spaces.moveWindowToSpace(appWindow, currentSpace)
-- appWindow:focus()
-- hs.spaces.moveWindowToSpace(app:mainWindow(), hs.spaces.focusedSpace(), true)
-- app:setFrontmost()
-- app = hs.application.open(terminalApp, 5, true)
-- showHotWindow(app)
-- transformWindow(app, hs.screen.mainScreen())
local appWindow = showHotWindow(app)
transformWindow(appWindow)
end
function HotTerm:init()
hs.hotkey.bind({ "cmd", "alt" }, "space", toggleTerminal)
end
return HotTerm