-
Notifications
You must be signed in to change notification settings - Fork 28
/
xnomad
executable file
·112 lines (96 loc) · 3.38 KB
/
xnomad
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
#!/usr/local/tranquil/bin/tranquil
import "WindowManager"
import "Hotkeys"
import "Layouts"
wm = WindowManager new
setDefaultRatio: 0.7;
setWindowsInMaster: 1;
\ See Layouts.tq for additional ones
setLayouts: [MultiColLayout new,
MultiColLayout new setHorizontallyFlipped: yes; self,
FullscreenLayout new];
reflow; self
mgr = HotkeyManager new
mod1 = [#option, #control]
mod2 = mod1 + [#shift]
\ Window selection
mgr registerHotkey: #k withModifiers: mod1 handler: {
wm selectPreviousWindow: AccessibilityWindow frontMostWindow;
reflow
}
mgr registerHotkey: #j withModifiers: mod1 handler: {
wm selectNextWindow: AccessibilityWindow frontMostWindow;
reflow
}
\ Swapping
mgr registerHotkey: #return withModifiers: mod1 handler: {
win = AccessibilityWindow frontMostWindow
other = wm swapWithCounterpart: win
other raise if (other frame)[0][0] > 10 \ If the other window was made primary
\ then it makes sense to give it focus
wm reflow
}
mgr registerHotkey: #k withModifiers: mod2 handler: {
wm swapWithPreviousWindow: AccessibilityWindow frontMostWindow; reflow
}
mgr registerHotkey: #j withModifiers: mod2 handler: {
wm swapWithNextWindow: AccessibilityWindow frontMostWindow; reflow
}
\ Master/slave column ratio
mgr registerHotkey: #l withModifiers: mod1 handler: {
screen = AccessibilityWindow frontMostWindow screen
space = wm currentSpaceId
wm setRatio: (wm ratioForScreen: screen space: space) + 0.05
forScreen: screen space: space;
reflow
}
mgr registerHotkey: #h withModifiers: mod1 handler: {
screen = AccessibilityWindow frontMostWindow screen
space = wm currentSpaceId
wm setRatio: (wm ratioForScreen: screen space: space) - 0.05
forScreen: screen
space: space;
reflow
}
\ Master count
mgr registerHotkey: #"." withModifiers: mod1 handler: {
screen = AccessibilityWindow frontMostWindow screen
space = wm currentSpaceId
wm setMaxMasters: (wm maxMastersOnScreen: screen space: space) + 1
onScreen: screen
space: space;
reflow
}
mgr registerHotkey: #"," withModifiers: mod1 handler: {
screen = AccessibilityWindow frontMostWindow screen
space = wm currentSpaceId
wm setMaxMasters: (wm maxMastersOnScreen: screen space: space) - 1
onScreen: screen
space: space;
reflow
}
\ Layout cycling
mgr registerHotkey: #" " withModifiers: mod2 handler: {
wm cycleLayouts; reflow
}
\ Display focus
mgr registerHotkey: #w withModifiers: mod1 handler: {
wm focusOnScreen: screens[0] if (screens = NSScreen screens) count >= 1
}
mgr registerHotkey: #e withModifiers: mod1 handler: {
wm focusOnScreen: screens[1] if (screens = NSScreen screens) count >= 2
}
\ Moving windows between displays
mgr registerHotkey: #w withModifiers: mod2 handler: {
if (screens = NSScreen screens) count >= 1 {
wm moveWindow: AccessibilityWindow frontMostWindow toScreen: screens[0];
reflow
}
}
mgr registerHotkey: #e withModifiers: mod2 handler: {
if (screens = NSScreen screens) count >= 2 {
wm moveWindow: AccessibilityWindow frontMostWindow toScreen: screens[1];
reflow
}
}
NSApplication sharedApplication run