feat: auto connect to tmux if ssh

This commit is contained in:
max_richter 2022-01-31 15:08:08 +01:00
parent e4c5eff011
commit 5bd1403f91
2 changed files with 19 additions and 2 deletions

View File

@ -112,5 +112,16 @@ if ! shopt -oq posix; then
fi
fi
if ! command -v tmux &> /dev/null
then
echo "<the_command> could not be found"
exit
else
# Auto connect to tmux session of ssh
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
fi
fi
[ -z $DISPLAY ] && export DISPLAY=127.0.0.1:0.0
. "$HOME/.cargo/env"

View File

@ -1,4 +1,5 @@
# vi: ft=conf
# /go
# Default config for sway
#
@ -6,6 +7,8 @@
#
# Read `man 5 sway` for a complete reference.
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
### Variables
#
# Logo key. Use Mod1 for Alt.
@ -30,6 +33,8 @@ set $windowshot swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) |
# Default Programs
set $term alacritty
set $explorer nautilus
set $browser google-chrome
set $config_editor ~/.config/sway/config_editor.sh
set $settings gnome-control-center
set $toggle_layout ~/.config/sway/toggle_layout.sh
@ -98,6 +103,7 @@ output * bg `find ~/.customization/background -type f | shuf -n 1` fill
bindsym $mod+Return exec $term
bindsym $mod+e exec $explorer
bindsym $mod+Comma exec $settings
bindsym $mod+b exec $browser
bindsym $mod+Shift+Comma exec $config_editor
bindsym $mod+a exec $web_search
@ -190,8 +196,8 @@ output * bg `find ~/.customization/background -type f | shuf -n 1` fill
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# bindsym $mod+b splith
# bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+w exec $toggle_layout