chore: use tabs instead of spaces for formatting

This commit is contained in:
Dillon Lees 2020-07-07 10:16:53 -04:00 committed by Bruno Sutic
parent 9f0cf6581b
commit cf5715d5fa
No known key found for this signature in database
GPG Key ID: CAFA7B1B2914ED81
2 changed files with 61 additions and 61 deletions

View File

@ -1,22 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/../helpers.sh" source "$CURRENT_DIR/../helpers.sh"
source "$CURRENT_DIR/../variables.sh" source "$CURRENT_DIR/../variables.sh"
template() { template() {
local tmux_start_script="$1" local tmux_start_script="$1"
local is_fullscreen="$2" local is_fullscreen="$2"
local fullscreen_tag="" local fullscreen_tag=""
if [ "$is_fullscreen" == "true" ]; then if [ "$is_fullscreen" == "true" ]; then
# newline and spacing so tag is aligned with other tags in template # newline and spacing so tag is aligned with other tags in template
fullscreen_tag=$'\n <string>fullscreen</string>' fullscreen_tag=$'\n <string>fullscreen</string>'
fi fi
local content local content
read -r -d '' content <<- EOF read -r -d '' content <<-EOF
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
@ -32,37 +32,37 @@ template() {
</dict> </dict>
</plist> </plist>
EOF EOF
echo "$content" echo "$content"
} }
get_iterm_or_teminal_option_value() { get_iterm_or_teminal_option_value() {
local options="$1" local options="$1"
if [[ "$options" =~ "iterm" ]]; then if [[ "$options" =~ "iterm" ]]; then
echo "iterm" echo "iterm"
elif [[ "$options" =~ "kitty" ]]; then elif [[ "$options" =~ "kitty" ]]; then
echo "kitty" echo "kitty"
else else
# Terminal.app is the default console app # Terminal.app is the default console app
echo "terminal" echo "terminal"
fi fi
} }
get_fullscreen_option_value() { get_fullscreen_option_value() {
local options="$1" local options="$1"
if [[ "$options" =~ "fullscreen" ]]; then if [[ "$options" =~ "fullscreen" ]]; then
echo "true" echo "true"
else else
echo "false" echo "false"
fi fi
} }
main() { main() {
local options="$(get_tmux_option "$auto_start_config_option" "$auto_start_config_default")" local options="$(get_tmux_option "$auto_start_config_option" "$auto_start_config_default")"
local iterm_or_terminal_value="$(get_iterm_or_teminal_option_value "$options")" local iterm_or_terminal_value="$(get_iterm_or_teminal_option_value "$options")"
local fullscreen_option_value="$(get_fullscreen_option_value "$options")" local fullscreen_option_value="$(get_fullscreen_option_value "$options")"
local tmux_start_script_path="${CURRENT_DIR}/osx_${iterm_or_terminal_value}_start_tmux.sh" local tmux_start_script_path="${CURRENT_DIR}/osx_${iterm_or_terminal_value}_start_tmux.sh"
local launchd_plist_file_content="$(template "$tmux_start_script_path" "$fullscreen_option_value")" local launchd_plist_file_content="$(template "$tmux_start_script_path" "$fullscreen_option_value")"
echo "$launchd_plist_file_content" > "$osx_auto_start_file_path" echo "$launchd_plist_file_content" > "$osx_auto_start_file_path"
} }
main main

View File

@ -4,44 +4,44 @@
TRUE_FULL_SCREEN="$1" TRUE_FULL_SCREEN="$1"
start_terminal_and_run_tmux() { start_terminal_and_run_tmux() {
osascript <<- EOF osascript <<-EOF
tell application "kitty" tell application "kitty"
activate activate
delay 5 delay 5
tell application "System Events" to tell process "kitty" tell application "System Events" to tell process "kitty"
set frontmost to true set frontmost to true
keystroke "tmux" keystroke "tmux"
key code 36 key code 36
end tell end tell
end tell end tell
EOF EOF
} }
resize_window_to_full_screen() { resize_window_to_full_screen() {
osascript <<- EOF osascript <<-EOF
tell application "kitty" tell application "kitty"
activate activate
tell application "System Events" tell application "System Events"
if (every window of process "kitty") is {} then if (every window of process "kitty") is {} then
keystroke "n" using command down keystroke "n" using command down
end if end if
tell application "Finder" tell application "Finder"
set desktopSize to bounds of window of desktop set desktopSize to bounds of window of desktop
end tell
set position of front window of process "kitty" to {0, 0}
set size of front window of process "kitty" to {item 3 of desktopSize, item 4 of desktopSize}
end tell end tell
set position of front window of process "kitty" to {0, 0}
set size of front window of process "kitty" to {item 3 of desktopSize, item 4 of desktopSize}
end tell end tell
end tell EOF
EOF
} }
resize_to_true_full_screen() { resize_to_true_full_screen() {
osascript <<- EOF osascript <<-EOF
tell application "kitty" tell application "kitty"
activate activate
delay 1 delay 1
tell application "System Events" to tell process "kitty" tell application "System Events" to tell process "kitty"
keystroke "f" using {control down, command down} keystroke "f" using {control down, command down}
end tell end tell
@ -50,11 +50,11 @@ resize_to_true_full_screen() {
} }
main() { main() {
start_terminal_and_run_tmux start_terminal_and_run_tmux
if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then if [ "$TRUE_FULL_SCREEN" == "fullscreen" ]; then
resize_to_true_full_screen resize_to_true_full_screen
else else
resize_window_to_full_screen resize_window_to_full_screen
fi fi
} }
main main