-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiProjectFocus.ahk
More file actions
103 lines (81 loc) · 2.7 KB
/
MultiProjectFocus.ahk
File metadata and controls
103 lines (81 loc) · 2.7 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
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
; ==============================
; keyboard shortcuts in AHK (v2)
; ==============================
#SingleInstance Force
mpfExePath := A_ScriptDir ".\..\appBin\main\app\MultiProjectFocus\MultiProjectFocus.exe"
if !FileExist(mpfExePath) {
MsgBox "Cannot find: " mpfExePath, "Error", 16
ExitApp
}
; `CapsLock u` - opens UI
CapsLock & u::
{
windowSelector := "Multi Project Focus ahk_exe MultiProjectFocus.exe"
if WinExist(windowSelector) {
WinShow windowSelector
WinRestore windowSelector
WinActivate windowSelector
return
}
RunMultiProjectFocus("ShowUI")
}
; =========================================================
; shortcuts for 'current project' (open folder, open files)
; =========================================================
; `CapsLock f` - opens current project folder
CapsLock & f::
{
RunMultiProjectFocus("ProjectCurrent.OpenFolder")
}
; `CapsLock+digit (1..9)` - opens current project files 1..9.
Loop 9 {
digit := A_Index
Hotkey "CapsLock & " digit, OpenCurrentProjectFile.Bind(digit)
}
; ========================================================
; shortcuts for 'pinned project' (open folder, open files)
; ========================================================
; `CapsLock p, num_A, num_B` - opens pinned project num_A and its file num_B
; example: `CapsLock p, 2, 4` opens file nr 4 in pinned project nr 2
;
; `CapsLock p, num_A, f` - opens pinned project num_A and its folder
; example: `CapsLock p, 2, f` opens folder in pinned project nr 2
CapsLock & p::
{
keySequence := InputHook("L2 T2")
keySequence.Start()
keySequence.Wait()
if RegExMatch(keySequence.Input, "^\d[\dfF]$") {
keyA := SubStr(keySequence.Input, 1, 1)
keyB := SubStr(keySequence.Input, 2, 1)
if (StrLower(keyB) = "f") {
RunMultiProjectFocus("ProjectPinned(pinPosition:" keyA ").OpenFolder")
} else {
RunMultiProjectFocus("ProjectPinned(pinPosition:" keyA ").OpenFile(file:F" keyB ")")
}
}
}
OpenCurrentProjectFile(fileNumber, *)
{
RunMultiProjectFocus("ProjectCurrent.OpenFile(file:F" fileNumber ")")
}
RunMultiProjectFocus(arg)
{
global mpfExePath
Run '"' mpfExePath '" "' arg '"'
}
; ==================================
; shortcuts for `projects.toml` file
; ==================================
; `CapsLock l` - loads initial projects from file
CapsLock & l::
{
projectsTomlPath := A_ScriptDir "\..\assets\projects.real.toml"
RunMultiProjectFocus("LoadInitialData(file:" projectsTomlPath ")")
}
; `CapsLock o` - opens projects TOML file in system default editor
CapsLock & o::
{
projectsTomlPath := A_ScriptDir "\..\assets\projects.real.toml"
Run projectsTomlPath
}