Slate

Giới thiệu

  • Ứng dụng quản lý (tạo, di chuyển, chuyển đổi, …) các cửa sổ trên MAC OS
  • Một số chức năng
    • Move/Resize/Shift windows
    • Switch Windows
    • Manage multiple monitors
    • Save window layouts
  • Chương trình tương tự: SizeUp, Mizage - Divvy, Hyperspaces, VirtueDesktops, Cinch, …
  • Tham khảo
    • https://github.com/jigish/slate
    • http://thume.ca/howto/2012/11/19/using-slate/
    • http://mauriciogardini.com/post/43348489262/slate-a-mac-os-x-window-manager-for-power-users
    • http://cereal.rutgers.edu/~vverna/keyboard-focused-workflow-macs.html

Các thao tác hỗ trợ

  • Chỉ quản lý màn hình (screen), chưa hỗ trợ space
  • move/resize: di chuyển/thay đổi kích thước cửa sổ
  • push: di chuyển cửa sổ tới cạnh của màn hình
  • nudge: dịch chuyển cửa sổ theo hướng
  • throw: di chuyển cửa sổ tới màn hình khác
  • corner: di chuyển tới góc màn hình
  • shell: thực thi lệnh
  • hide: ẩn ứng dụng
  • show: hiển thị ứng dụng
  • focus: chọn cửa sổ hiện hành
  • hint: hiển thị các cửa sổ đang chạy
  • undo: quay lại
  • source: đọc tập tin cấu hình
  • snapshot/delete-snapshot/active-snapshot: chụp ảnh màn hình
  • toggle/chain/sequence: không biết?

Cấu hình

  • Tập tin cấu hình tên .slate trong thư mục home. Nếu không có tập tin, ứng dụng sẽ đọc cấu hình mặc định (giống nội dung tập tin default.slate trong https://github.com/jigish/slate/blob/master/Slate/default.slate
  • Tập tin cấu hình gồm các phần sau
    • config: các cấu hình chung
    • allias: tạo các biến allias
    • layout: cấu hình layouts
    • default: cấu hình màn hình để hỗ trợ layouts
    • bind: tạo phím tắt cho các hành động
    • source: đọc cấu hình từ các tập tin khác
  • Tập tin cấu hình mẫu: https://github.com/jigish/dotfiles/blob/master/slate
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
# Configs
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000

# Monitor Aliases
alias mon-laptop      1680x1050
alias mon-thunderbolt 2560x1440
alias mon-hp22inch    1920x1080

# Position Aliases
alias 1-chat  move screenOriginX;screenOriginY                               screenSizeX/9;screenSizeY       ${mon-laptop}
alias 1-main  move screenOriginX+screenSizeX/9;screenOriginY                 8*screenSizeX/9;screenSizeY     ${mon-laptop}
alias 2-bot   move screenOriginX;screenOriginY+screenSizeY/2                 screenSizeX;screenSizeY/2       ${mon-thunderbolt}
alias 2-bot-l move screenOriginX;screenOriginY+screenSizeY/2                 screenSizeX/3;screenSizeY/2     ${mon-thunderbolt}
alias 2-bot-m move screenOriginX+screenSizeX/3;screenOriginY+screenSizeY/2   screenSizeX/3;screenSizeY/2     ${mon-thunderbolt}
alias 2-bot-r move screenOriginX+2*screenSizeX/3;screenOriginY+screenSizeY/2 screenSizeX/3;screenSizeY/2     ${mon-thunderbolt}
alias 2-mid   move screenOriginX+screenSizeX/8;screenOriginY+screenSizeY/8   3*screenSizeX/4;3*screenSizeY/4 ${mon-thunderbolt}
alias 2-top   move screenOriginX;screenOriginY                               screenSizeX;screenSizeY/2       ${mon-thunderbolt}
alias 2-top-l move screenOriginX;screenOriginY                               screenSizeX/2;screenSizeY/2     ${mon-thunderbolt}
alias 2-top-m move screenOriginX+screenSizeX/6;screenOriginY                 2*screenSizeX/3;screenSizeY/2   ${mon-thunderbolt}
alias 2-top-r move screenOriginX+screenSizeX/2;screenOriginY                 screenSizeX/2;screenSizeY/2     ${mon-thunderbolt}
alias 2-left  move screenOriginX;screenOriginY                               screenSizeX/2;screenSizeY       ${mon-thunderbolt}
alias 2-right move screenOriginX+screenSizeX/2;screenOriginY                 screenSizeX/2;screenSizeY       ${mon-thunderbolt}
alias 3-l-bot move screenOriginX;screenOriginY+screenSizeY/2                 screenSizeX/2;screenSizeY/2     ${mon-hp22inch}
alias 3-l-top move screenOriginX;screenOriginY                               screenSizeX/2;screenSizeY/2     ${mon-hp22inch}
alias 3-right move screenOriginX+screenSizeX/2;screenOriginY                 screenSizeX/2;screenSizeY       ${mon-hp22inch}

# 3 Monitor layout
layout 3monitors 'iTerm':SORT_TITLE                       ${2-bot-l} | ${2-bot-m} | ${2-bot-r}
layout 3monitors 'Google Chrome':REPEAT_LAST,TITLE_ORDER_REGEX=^Developer\sTools\s-\s.+$  ${3-right} | ${1-main}
layout 3monitors 'MacVim'                                 ${2-top-r} | ${2-top-l} | ${2-top-m}
layout 3monitors 'Flex Builder'                           ${2-top-l}
layout 3monitors 'GitX':REPEAT                            ${3-right}
layout 3monitors 'Ooyala Player Debug Console'            ${3-l-bot}
layout 3monitors 'Adium':IGNORE_FAIL,TITLE_ORDER=Contacts ${1-chat} | ${3-l-bot}
layout 3monitors 'Firefox':REPEAT                         ${2-mid}
layout 3monitors 'Xcode':REPEAT                           ${2-top}
layout 3monitors 'Eclipse':REPEAT                         ${2-bot}
layout 3monitors 'Spotify':REPEAT                         ${3-l-top}

# 2 Monitor layout
layout 2monitors 'iTerm':SORT_TITLE                       ${2-bot-l} | ${2-bot-m} | ${2-bot-r}
layout 2monitors 'Google Chrome':REPEAT                   ${1-main}
layout 2monitors 'MacVim'                                 ${2-top-r} | ${2-top-l} | ${2-top-m}
layout 2monitors 'Flex Builder'                           ${2-top-l}
layout 2monitors 'GitX':REPEAT                            ${1-main}
layout 2monitors 'Ooyala Player Debug Console'            ${1-main}
layout 2monitors 'Adium':IGNORE_FAIL,TITLE_ORDER=Contacts ${1-chat} | ${1-main}
layout 2monitors 'Firefox':REPEAT                         ${2-mid}
layout 2monitors 'Xcode':REPEAT                           ${2-top}
layout 2monitors 'Eclipse':REPEAT                         ${2-bot}
layout 2monitors 'Spotify':REPEAT                         ${1-main}

# 1 Monitor layout
layout 1monitor 'iTerm':SORT_TITLE,REPEAT                ${1-main}
layout 1monitor 'Google Chrome':REPEAT                   ${1-main}
layout 1monitor 'MacVim':REPEAT                          ${1-main}
layout 1monitor 'Flex Builder':REPEAT                    ${1-main}
layout 1monitor 'GitX':REPEAT                            ${1-main}
layout 1monitor 'Ooyala Player Debug Console':REPEAT     ${1-main}
layout 1monitor 'Adium':IGNORE_FAIL,TITLE_ORDER=Contacts ${1-chat} | ${1-main}
layout 1monitor 'Firefox':REPEAT                         ${1-main}
layout 1monitor 'Xcode':REPEAT                           ${1-main}
layout 1monitor 'Eclipse':REPEAT                         ${1-main}
layout 1monitor 'Spotify':REPEAT                         ${1-main}

# Default Layouts
default 3monitors resolutions:${mon-laptop};${mon-thunderbolt};${mon-hp22inch}
default 2monitors resolutions:${mon-laptop};${mon-thunderbolt}
default 1monitor  resolutions:${mon-laptop}

# Basic location Bindings
bind pad0:ctrl ${1-chat}
bind [:ctrl    ${1-chat}
bind pad.:ctrl ${1-main}
bind ]:ctrl    ${1-main}
bind pad1:ctrl ${2-bot-l}
bind pad2:ctrl ${2-bot-m}
bind pad3:ctrl ${2-bot-r}
bind pad4:ctrl ${2-left}
bind pad5:ctrl ${2-mid}
bind pad6:ctrl ${2-right}
bind pad7:ctrl ${2-top-l}
bind pad8:ctrl ${2-top-m}
bind pad9:ctrl ${2-top-r}
bind pad=:ctrl ${2-top}
bind pad/:ctrl ${2-bot}
bind pad*:ctrl ${3-l-bot}
bind pad-:ctrl ${3-l-top}
bind pad+:ctrl ${3-right}

# Resize Bindings
# NOTE: some of these may *not* work if you have not removed the expose/spaces/mission control bindings
bind right:ctrl resize +10% +0
bind left:ctrl  resize -10% +0
bind up:ctrl    resize +0   -10%
bind down:ctrl  resize +0   +10%
bind right:alt  resize -10% +0 bottom-right
bind left:alt   resize +10% +0 bottom-right
bind up:alt     resize +0   +10% bottom-right
bind down:alt   resize +0   -10% bottom-right

# Push Bindings
# NOTE: some of these may *not* work if you have not removed the expose/spaces/mission control bindings
bind right:ctrl;shift push right bar-resize:screenSizeX/3
bind left:ctrl;shift  push left  bar-resize:screenSizeX/3
bind up:ctrl;shift    push up    bar-resize:screenSizeY/2
bind down:ctrl;shift  push down  bar-resize:screenSizeY/2

# Nudge Bindings
# NOTE: some of these may *not* work if you have not removed the expose/spaces/mission control bindings
bind right:ctrl;alt nudge +10% +0
bind left:ctrl;alt  nudge -10% +0
bind up:ctrl;alt    nudge +0   -10%
bind down:ctrl;alt  nudge +0   +10%

# Throw Bindings
# NOTE: some of these may *not* work if you have not removed the expose/spaces/mission control bindings
bind pad1:ctrl;alt      throw 2 resize
bind pad2:ctrl;alt      throw 1 resize
bind pad3:ctrl;alt      throw 0 resize
bind right:ctrl;alt;cmd throw right resize
bind left:ctrl;alt;cmd  throw left  resize
bind up:ctrl;alt;cmd    throw up    resize
bind down:ctrl;alt;cmd  throw down  resize

# Focus Bindings
# NOTE: some of these may *not* work if you have not removed the expose/spaces/mission control bindings
bind right:cmd    focus right
bind left:cmd     focus left
bind up:cmd       focus up
bind down:cmd     focus down
bind up:cmd;alt   focus behind
bind down:cmd;alt focus behind

# Layout Bindings
bind padEnter:ctrl layout 3monitors

# Window Hints
bind esc:cmd hint

# Switch currently doesn't work well so I'm commenting it out until I fix it.
#bind tab:ctrl switch

# Grid
bind esc:ctrl grid

# Test Cases
source .slate.test if_exists

Danh sách phím trong tập tin cấu hình

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
'
,
-
.
/
0
1
2
3
4
5
6
7
8
9
;
=
`
a
b
backslash
c
caps
d
delete
down
e
end
esc
f
f1
f10
f11
f12
f13
f14
f15
f16
f17
f18
f19
f2
f20
f3
f4
f5
f6
f7
f8
f9
g
h
help
home
i
j
k
l
left
m
mute
n
o
p
pad*
pad+
pad-
pad.
pad/
pad0
pad1
pad2
pad3
pad4
pad5
pad6
pad7
pad8
pad9
pad=
padClear
padEnter
pageDown
pageUp
q
r
return
right
s
space
t
tab
u
up
v
w
x
y
z
[
]