-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkomorebi.ahk
247 lines (214 loc) · 6.43 KB
/
komorebi.ahk
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#Requires AutoHotkey v2.0
; Shortcut Guide
;\
;\ # = Super
;\ ! = Alt
;\ ^ = Ctrl
;\ + = Shift
#SingleInstance Force
; Load library
#Include komorebic.lib.ahk
; Load configuration
#Include komorebi.generated.ahk
;; NOTE: configuration section (ending in CompleteConfiguration() if using static config (komorebi.json)
; Send the ALT key whenever changing focus to force focus changes
AltFocusHack("enable")
; Default to cloaking windows when switching workspaces
; WindowHidingBehaviour("minimize")
WindowHidingBehaviour("cloak")
; Set cross-monitor move behaviour to insert instead of swap
CrossMonitorMoveBehaviour("Insert")
; NOTE: dangerous? Enable hot reloading of changes to this file
WatchConfiguration("enable")
; Create named workspaces I-V on monitor 0
EnsureNamedWorkspaces(0, "I II III IV V")
; You can do the same thing for secondary monitors too
EnsureNamedWorkspaces(1, "A B C D E F")
; Assign layouts to workspaces, possible values: bsp, columns, rows, vertical-stack, horizontal-stack, ultrawide-vertical-stack
; NOTE: assigning them a workspace layout prevents resizing
; NamedWorkspaceLayout("I", "ultrawide-vertical-stack")
; NamedWorkspaceLayout("II", "ultrawide-vertical-stack")
; NamedWorkspaceLayout("III", "vertical-stack")
; Set the gaps around the edge of the screen for a workspace
NamedWorkspacePadding("I", 0)
NamedWorkspacePadding("II", 0)
NamedWorkspacePadding("III", 0)
NamedWorkspacePadding("IIII", 0)
NamedWorkspacePadding("IV", 0)
; Set the gaps between the containers for a workspace
NamedWorkspaceContainerPadding("I", 0)
NamedWorkspaceContainerPadding("II", 0)
NamedWorkspaceContainerPadding("III", 0)
NamedWorkspaceContainerPadding("IIII", 0)
NamedWorkspaceContainerPadding("IV", 0)
; You can assign specific apps to named workspaces
; NamedWorkspaceRule("exe", "Vivaldi.exe", "I")
; NamedWorkspaceRule("exe", "mstsc.exe", "II")
; NamedWorkspaceRule("exe", "Teams.exe", "II")
; NamedWorkspaceRule("exe", "Steam.exe", "III")
; NamedWorkspaceRule("exe", "TidalPlayer.exe", "III")
; NamedWorkspaceRule("exe", "Creative.App.exe", "III")
; NamedWorkspaceRule("exe", "SteelSeriesGGClient.exe", "III")
; Configure the invisible border dimensions
InvisibleBorders(7, 0, 14, 7)
; Uncomment the next lines if you want a visual border around the active window
ActiveWindowBorder("enable")
; ActiveWindowBorderColour(66, 165, 245, "single")
;ActiveWindowBorderColour(256, 165, 66, "stack")
; ActiveWindowBorderColour(255, 51, 153, "monocle")
; Nicer, more muted colours
; active/single = light green
ActiveWindowBorderColour(161, 203, 187, "single")
; stack = blue
ActiveWindowBorderColour(53, 114, 165, "stack")
; monacle = red
ActiveWindowBorderColour(211, 134, 155, "monocle")
; NOTE: CompleteConfiguration denotes the end of the declarative config,
; NOTE: i.e. komorebi.exe can now safely start
; Everything after this is for runtime declaractions like hotkeys
CompleteConfiguration()
#!^6:: {
;; BUG: annoying that it open a new vivaldi window when there is an existing hidden one in a stack
;; BUG: Seems to only happen when NOT on using WindowHidingBehaviour("minimize") above (default is "cloak")
if WinExist("ahk_exe" "vivaldi.exe") ;; TODO: try AND ProcessExist: https://www.autohotkey.com/docs/v2/lib/ProcessExist.htm
WinActivate
; else
; Run "vivaldi.exe"
}
#!^7:: {
if WinExist("ahk_exe" "Teams.exe")
WinActivate
; else
; Run "Teams.exe"
}
; #!^7:: {
; if WinExist("ahk_exe" "WindowsTerminal.exe")
; WinActivate
; ; else
; ; Run "wt.exe"
; }
#!^8:: {
if WinExist("ahk_exe" "mstsc.exe")
WinActivate
}
#!^9:: {
if WinExist("ahk_exe" "TIDAL.exe")
WinActivate
; else
; Run "TIDAL.exe"
}
; Focus windows
#h::Focus("left")
#j::Focus("down")
#k::Focus("up")
#l::Focus("right")
#o::CycleFocus("previous")
#i::CycleFocus("next")
; Backup for RDP, when win-L cannot be bound
; #left::Focus("left")
; #down::Focus("down")
; #up::Focus("up")
; #right::Focus("right")
; Focus
#Enter::Promote()
#!Enter::PromoteFocus()
; Move windows
#+h::Move("left")
#+j::Move("down")
#+k::Move("up")
#+l::Move("right")
#+left::Move("left")
#+down::Move("down")
#+up::Move("up")
#+right::Move("right")
; Stack windows
#^h::Stack("left")
#^l::Stack("right")
#^k::Stack("up")
#^j::Stack("down")
#^;::Unstack()
#;::Unstack()
#^o::CycleStack("previous")
#^i::CycleStack("next")
; Resize
#]::ResizeAxis("horizontal", "increase")
#[::ResizeAxis("horizontal", "decrease")
#+]::ResizeAxis("vertical", "increase")
#+[::ResizeAxis("vertical", "decrease")
; Manipulate windows
#t::ToggleFloat()
#f::ToggleMonocle()
;; BUG: appears broken; use my own win+m
; #!up::ToggleMaximize()
#!down::Minimize()
; Window manager options
#!r::Retile()
#!p::TogglePause()
;; komorebi Process management
;; kill and restart process - finally confirmed working
#!^r:: {
Run "taskkill /f /im komorebi.exe"
Run "komorebic.exe start -a --ahk"
Reload
}
#!^s::Start("", true, "")
; #!^s::Run "komorebic start -c $Env:KOMOREBI_CONFIG_HOME\komorebi.json"
;; nuke it
#!^q::Run "taskkill /f /im komorebi.exe"
#!^o::ReloadConfiguration()
; NOTE: Sometimes works to reload
#!^h::Reload
; Layouts
#x::FlipLayout("horizontal")
#y::FlipLayout("vertical")
; Switch to an equal-width
; max-height column layout on the main workspace, Win + Shift + C
; -------------
; | | | |
; | | | |
; -------------
#+c::{
Run "komorebic change-layout columns", ,"Hide"
}
; -------------
; | | | |
; | | | |
; -------------
#+v::{
Run "komorebic change-layout ultrawide-vertical-stack", ,"Hide"
}
; NOTE: (B)inary (S)pace (P)artition
; --------------
; | | |
; | |--------
; | | | |
; --------------
#+b::{
Run "komorebic change-layout bsp", ,"Hide"
}
; TODO: custom layout; currently looks identical to ultrawide-vertical-stack
#+n::{
Run "komorebic load-custom-layout $Env:KOMOREBI_CONFIG_HOME\custom\ultrawide.json", ,"Hide"
}
;; Manage & Unmanage focused application
#!m::Manage()
#!u::Unmanage()
; Workspaces
#F5::QuickSaveResize()
#!^+s::QuickSaveResize()
#F6::QuickLoadResize()
#!^+l::QuickLoadResize()
#+F5::SaveResize("$Env:HOME\.config\komorebi\workspace")
#+F6::LoadResize("$Env:HOME\.config\komorebi\workspace")
; move to workspace
#6::FocusWorkspace(0)
#7::FocusWorkspace(1)
#8::FocusWorkspace(2)
#9::FocusWorkspace(3)
#0::FocusWorkspace(4)
; Move windows across workspaces
#+6::MoveToWorkspace(0)
#+7::MoveToWorkspace(1)
#+8::MoveToWorkspace(2)
#+9::MoveToWorkspace(3)
#+0::MoveToWorkspace(4)