Skip to content

Commit 5a75f07

Browse files
authored
Merge pull request #85 from chrisminton/alacritty-start-option
feat: add alacritty to the list of auto start terminals
2 parents 26eb5ff + 154e386 commit 5a75f07

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

docs/automatic_start.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ Config options:
2424
of `Terminal.app`
2525
- `set -g @continuum-boot-options 'kitty,fullscreen'` - start `kitty`
2626
in fullscreen
27+
- `set -g @continuum-boot-options 'alacritty'` - start [alacritty](https://github.com/alacritty/alacritty) instead of `Terminal.app`
28+
- `set -g @continuum-boot-options 'alacritty,fullscreen'` - start `alacritty`
29+
in fullscreen
2730

2831
Note: The first time you reboot your machine and activate this feature you may be prompted about a script requiring
2932
access to a system program (i.e. - System Events). If this happens tmux will not start automatically and you will need
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env bash
2+
3+
# for "true full screen" call the script with "fullscreen" as the first argument
4+
TRUE_FULL_SCREEN="$1"
5+
6+
start_terminal_and_run_tmux() {
7+
osascript <<-EOF
8+
tell application "alacritty"
9+
activate
10+
delay 0.5
11+
tell application "System Events" to tell process "alacritty"
12+
set frontmost to true
13+
keystroke "tmux"
14+
key code 36
15+
end tell
16+
end tell
17+
EOF
18+
}
19+
20+
resize_window_to_full_screen() {
21+
osascript <<-EOF
22+
tell application "alacritty"
23+
activate
24+
tell application "System Events"
25+
if (every window of process "alacritty") is {} then
26+
keystroke "n" using command down
27+
end if
28+
29+
tell application "Finder"
30+
set desktopSize to bounds of window of desktop
31+
end tell
32+
33+
set position of front window of process "alacritty" to {0, 0}
34+
set size of front window of process "alacritty" to {item 3 of desktopSize, item 4 of desktopSize}
35+
end tell
36+
end tell
37+
EOF
38+
}
39+
40+
resize_to_true_full_screen() {
41+
osascript <<-EOF
42+
tell application "Alacritty"
43+
activate
44+
delay 0.5
45+
tell application "System Events" to tell process "Alacritty"
46+
if front window exists then
47+
tell front window
48+
if value of attribute "AXFullScreen" then
49+
set value of attribute "AXFullScreen" to false
50+
else
51+
set value of attribute "AXFullScreen" to true
52+
end if
53+
end tell
54+
end if
55+
end tell
56+
end tell
57+
EOF
58+
}
59+
60+
main() {
61+
start_terminal_and_run_tmux
62+
if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then
63+
resize_to_true_full_screen
64+
else
65+
resize_window_to_full_screen
66+
fi
67+
}
68+
main
69+
70+
resize_to_

scripts/handle_tmux_automatic_start/osx_enable.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ get_strategy() {
4141
echo "iterm"
4242
elif [[ "$options" =~ "kitty" ]]; then
4343
echo "kitty"
44+
elif [[ "$options" =~ "alacritty" ]]; then
45+
echo "alacritty"
4446
else
4547
# Terminal.app is the default console app
4648
echo "terminal"

0 commit comments

Comments
 (0)