Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WezTerm support #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/automatic_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Config options:
- `set -g @continuum-boot-options 'alacritty'` - start [alacritty](https://github.com/alacritty/alacritty) instead of `Terminal.app`
- `set -g @continuum-boot-options 'alacritty,fullscreen'` - start `alacritty`
in fullscreen
- `set -g @continuum-boot-options 'wezterm'` - start [wezterm](https://github.com/wez/wezterm) instead
of `Terminal.app`
- `set -g @continuum-boot-options 'wezterm,fullscreen'` - start `wezterm`
in fullscreen

Note: The first time you reboot your machine and activate this feature you may be prompted about a script requiring
access to a system program (i.e. - System Events). If this happens tmux will not start automatically and you will need
Expand Down
2 changes: 2 additions & 0 deletions scripts/handle_tmux_automatic_start/osx_enable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ get_strategy() {
echo "iterm"
elif [[ "$options" =~ "kitty" ]]; then
echo "kitty"
elif [[ "$options" =~ "wezterm" ]]; then
echo "wezterm"
elif [[ "$options" =~ "alacritty" ]]; then
echo "alacritty"
else
Expand Down
71 changes: 71 additions & 0 deletions scripts/handle_tmux_automatic_start/osx_wezterm_start_tmux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash

# Maintainer: Fernando Silva @fcaraujo
# # Contact maintainer for any change to this file.

# for "true full screen" call the script with "fullscreen" as the first argument
TRUE_FULL_SCREEN="$1"

start_terminal_and_run_tmux() {
osascript <<-EOF
tell application "WezTerm"
activate
delay 1
tell application "System Events" to tell process "WezTerm"
set frontmost to true
keystroke "tmux"
key code 36
end tell
end tell
EOF
}

resize_window_to_full_screen() {
osascript <<-EOF
tell application "WezTerm"
activate
tell application "System Events"
if (every window of process "WezTerm") is {} then
keystroke "n" using command down
end if

tell application "Finder"
set desktopSize to bounds of window of desktop
end tell

set position of front window of process "WezTerm" to {0, 0}
set size of front window of process "WezTerm" to {item 3 of desktopSize, item 4 of desktopSize}
end tell
end tell
EOF
}

resize_to_true_full_screen() {
osascript <<-EOF
tell application "WezTerm"
activate
delay 1
tell application "System Events" to tell process "WezTerm"
if front window exists then
tell front window
if value of attribute "AXFullScreen" then
set value of attribute "AXFullScreen" to false
else
set value of attribute "AXFullScreen" to true
end if
end tell
end if
end tell
end tell
EOF
}

main() {
start_terminal_and_run_tmux
if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then
resize_to_true_full_screen
else
resize_window_to_full_screen
fi
}
main