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

tmux-continuum run at startup on linux #10

Open
wants to merge 1 commit 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
11 changes: 10 additions & 1 deletion scripts/handle_tmux_automatic_start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
UNAME="$(uname)"

source "$CURRENT_DIR/helpers.sh"
source "$CURRENT_DIR/variables.sh"
Expand All @@ -11,17 +12,25 @@ is_tmux_automatic_start_enabled() {
}

is_osx() {
[ $(uname) == "Darwin" ]
[ $UNAME == "Darwin" ]
}

is_linux() {
[ $UNAME == "Linux" ]
}

main() {
if is_tmux_automatic_start_enabled; then
if is_osx; then
"$CURRENT_DIR/handle_tmux_automatic_start/osx_enable.sh"
elif is_linux; then
"$CURRENT_DIR/handle_tmux_automatic_start/linux_enable.sh"
fi
else
if is_osx; then
"$CURRENT_DIR/handle_tmux_automatic_start/osx_disable.sh"
elif is_linux; then
"$CURRENT_DIR/handle_tmux_automatic_start/linux_disable.sh"
fi
fi
}
Expand Down
9 changes: 8 additions & 1 deletion scripts/handle_tmux_automatic_start/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ Config options:

### Linux

Help with this would be greatly appreciated. Please get in touch.
To enable this feature:
- put `set -g @continuum-boot 'on'` in `tmux.conf`
- reload tmux config with this shell command: `$ tmux source-file ~/.tmux.conf`

Next time the computer is started:
- `x-terminal-emulator` window will open
- `tmux` command will be executed in the terminal window
- if "auto restore" feature is enabled, tmux will start restoring previous env
10 changes: 10 additions & 0 deletions scripts/handle_tmux_automatic_start/linux_disable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$CURRENT_DIR/../variables.sh"

main() {
rm "$linux_auto_start_file_path" > /dev/null 2>&1
}
main
6 changes: 6 additions & 0 deletions scripts/handle_tmux_automatic_start/linux_enable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# stub
# =======
# Need to place a startup script in /etc/rc.local (for Debian and/or Redhat based linuxes). Slackware based distros have the same file, but named something slightly
# different.
3 changes: 3 additions & 0 deletions scripts/handle_tmux_automatic_start/linux_shell_activator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
"$@"
exec "$SHELL"
27 changes: 27 additions & 0 deletions scripts/handle_tmux_automatic_start/linux_terminal_start_tmux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# for "true full screen" call the script with "fullscreen" as the first argument
TRUE_FULL_SCREEN="$1"
TMUX="$(which tmux)"

start_terminal_and_run_tmux() {
x-terminal-emulator -e ./linux_shell_activator.sh $TMUX
}

resize_window_to_full_screen() {
echo "Resize is up to terminal emulator being used." > /dev/null 2>&1
}

resize_to_true_full_screen() {
echo "Resize is up to terminal emulator being used." > /dev/null 2>&1
}

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