aboutsummaryrefslogtreecommitdiff
path: root/hammerspoon/init.lua
blob: 94600931ad76277a89832741a97376247c25486b (plain)
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
local window = require "hs.window"
local hotkey = require "hs.hotkey"
local geom = require "hs.geometry"

window.animationDuration = 0

hotkey.bind({"alt"}, "0", function()
    local win = window.focusedWindow()
    win:maximize()
end)

hotkey.bind({"alt"}, "left", function()
    local win = window.focusedWindow()
    if win ~= nil then
        win:moveToUnit({x=0, y=0, w=0.5, h=1})
    end
end)

hotkey.bind({"alt"}, "right", function()
    local win = window.focusedWindow()
    if win ~= nil then
        win:moveToUnit({x=0.5, y=0, w=0.5, h=1})
    end
end)

hotkey.bind({"alt"}, "down", function()
    local win = window.focusedWindow()
    if win ~= nil then
       local screen_frame = win:screen():frame()
       local new_geom = geom.copy(win:frame())
       new_geom.w = 1280
       new_geom.h = screen_frame.h
       new_geom.center = screen_frame.center
       win:setFrame(new_geom)
    end
end)

hotkey.bind({"alt"}, "r", function()
    hs.reload()
end)

hotkey.bind({"alt"}, "c", function()
    hs.openConsole()
end)