-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
executable file
·134 lines (112 loc) · 5.56 KB
/
init.lua
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
-----------------------------------------------------------------------------------
-- File: init.lua
-- Author: Joaquín Cuitiño
-- License: MIT
-----------------------------------------------------------------------------------
local grid = require("grid")
local hyper = require("hyper")
local windowManager = require("window-manager")
local yabai = require("yabai")
-- local doubleShift = require("double-shift")
hyper.install("F18")
hyper.bindKey("r", hs.reload)
hyper.bindKey("`", hs.caffeinate.systemSleep)
hyper.remapKey("h", "left")
hyper.remapKey("j", "down")
hyper.remapKey("k", "up")
hyper.remapKey("l", "right")
hyper.remapKey("delete", "forwarddelete")
hyper.remap({}, "s", {"control", "shift", "cmd"}, "4") -- Screenshot area to clipboard
hyper.remap({"shift"}, "s", {"shift", "cmd"}, "4") -- Screenshot area to desktop
hyper.remap({"option"}, "s", {"shift", "cmd"}, "5") -- Screenshot/recording tool
-- Arrange windows for Chill configuration (dual display).
function chill()
apps = {
["com.microsoft.VSCode"] = { screen = 1, space = 1, position = grid.max },
["Rider"] = { screen = 1, space = 1, position = grid.max },
["Zed"] = { screen = 1, space = 1, position = grid.max },
["net.whatsapp.WhatsApp"] = { screen = 2, space = 1, position = grid.centerStage_topLeft },
["Mail"] = { screen = 2, space = 1, position = grid.centerStage_bottomLeft },
["Calendar"] = { screen = 2, space = 2, position = grid.centerStage_bottomLeftSidecar },
["com.spotify.client"] = { screen = 2, space = 1, position = grid.centerStage_bottomRight },
["com.apple.Safari"] = { screen = 2, space = 1, position = grid.centerStage },
}
windowManager.arrange(apps)
end
hyper.bindKey("c", chill)
-- Arrange windows for Desktop configuration (dual display).
function desktop()
apps = {
["com.tinyspeck.slackmacgap"] = { screen = 2, space = 2, position = grid.centerStage_topRight },
["com.spotify.client"] = { screen = 2, space = 2, position = grid.centerStage_bottomRight },
["Mail"] = { screen = 2, space = 2, position = grid.centerStage_bottomLeft },
["Hey"] = { screen = 2, space = 2, position = grid.centerStage_bottomLeft },
["Calendar"] = { screen = 2, space = 2, position = grid.centerStage_bottomLeftSidecar },
["com.apple.Safari"] = { screen = 2, space = 1, position = grid.right },
-- ["HookSounds - "] = { screen = 2, space = 1, position = grid.left },
-- ["Home - "] = { screen = 2, space = 1, position = grid.right },
["com.microsoft.VSCode"] = { screen = 1, space = 1, position = grid.max },
["Rider"] = { screen = 1, space = 1, position = grid.max },
["Zed"] = { screen = 1, space = 1, position = grid.max },
["net.whatsapp.WhatsApp"] = { screen = 2, space = 2, position = grid.centerStage_topLeft },
}
windowManager.arrange(apps)
end
hyper.bindKey("d", desktop)
-- Arrange windows for Game Dev configuration (dual display).
function gameDev()
apps = {
["com.tinyspeck.slackmacgap"] = { screen = 2, space = 2, position = grid.centerStage_topRight },
["com.spotify.client"] = { screen = 2, space = 2, position = grid.centerStage_bottomRight },
["Mail"] = { screen = 2, space = 2, position = grid.centerStage_bottomLeft },
["Sublime Merge"] = { screen = 2, space = 2, position = grid.centerStage_bottomLeftSidecar },
["com.apple.Safari"] = { screen = 2, space = 1, position = grid.right },
["Unity"] = { screen = 2, space = 1, position = grid.left },
["com.microsoft.VSCode"] = { screen = 1, space = 1, position = grid.max },
["Rider"] = { screen = 1, space = 1, position = grid.max },
["Zed"] = { screen = 1, space = 1, position = grid.max },
["net.whatsapp.WhatsApp"] = { screen = 2, space = 2, position = grid.centerStage_topLeft },
}
windowManager.arrange(apps)
end
hyper.bindKey("g", gameDev)
function launchDesktop()
hs.application.launchOrFocus("Mail")
hs.application.launchOrFocus("Code")
hs.application.launchOrFocus("Slack")
hs.application.launchOrFocus("net.whatsapp.WhatsApp")
hs.application.launchOrFocus("Toggl Track")
hs.application.launchOrFocus("com.apple.Safari")
hs.application.launchOrFocus("com.spotify.client")
end
hyper.bindKey("l", launchDesktop)
-- Arrange windows for on-the-go configuration (single display).
function mobile()
apps = {
["net.whatsapp.WhatsApp"] = { screen = 1, space = 3, position = grid.topLeft },
["com.tinyspeck.slackmacgap"] = { screen = 1, space = 3, position = grid.topRight },
["com.spotify.client"] = { screen = 1, space = 3, position = grid.bottomRight },
["HEY"] = { screen = 1, space = 3, position = grid.bottomLeft },
["Calendar"] = { screen = 1, space = 3, position = grid.bottomRight },
["com.microsoft.VSCode"] = { screen = 1, space = 2, position = grid.max },
["com.apple.Safari"] = { screen = 1, space = 1, position = grid.max },
}
windowManager.arrange(apps)
end
hyper.bindKey("e", mobile)
-- Kill front application. Press Hyper+F to pay respects.
function F()
local app = hs.application.frontmostApplication()
app:kill9()
end
hyper.bindKey("f", F)
function passwords()
local url = 'x-apple.systempreferences:com.apple.Passwords-Settings.extension'
local handler = 'com.apple.systempreferences'
hs.urlevent.openURLWithBundle(url, handler)
end
hyper.bindKey("p", passwords)
hyper.bindKey("1", function() yabai({"-m", "space", "--focus", "1"}) end) --["t"]
hyper.bindKey("2", function() yabai({"-m", "space", "--focus", "2"}) end) --["t"]
hyper.bindKey("q", function() yabai({"-m", "space", "--focus", "3"}) end) --["t"]
hyper.bindKey("w", function() yabai({"-m", "space", "--focus", "4"}) end) --["t"]