From 5bd1403f91d00a6bf4625b37ad94fc1b6c437134 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Mon, 31 Jan 2022 15:08:08 +0100 Subject: [PATCH] feat: auto connect to tmux if ssh --- configs/.bashrc | 11 +++++++++++ configs/sway/config | 10 ++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/configs/.bashrc b/configs/.bashrc index 359386c..660c96b 100644 --- a/configs/.bashrc +++ b/configs/.bashrc @@ -112,5 +112,16 @@ if ! shopt -oq posix; then fi fi +if ! command -v tmux &> /dev/null +then + echo " 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" diff --git a/configs/sway/config b/configs/sway/config index 2f18e33..084e4a7 100644 --- a/configs/sway/config +++ b/configs/sway/config @@ -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