update tmux scopes

This commit is contained in:
Tomasz Kapias 2023-03-19 22:52:13 +07:00
parent fc157b8105
commit c4ff5771dc
Signed by: tkapias
SSH key fingerprint: SHA256:bsmasrX7y0xxAHa/x1x8zAgHInO4nPpKMk5JIQ0Vsbw
2 changed files with 4 additions and 4 deletions

View file

@ -13,10 +13,10 @@ chmod 600 ~/.bashrc ~/.bashrc.d/*
# check if we are already in a Tmux session or open/attach the default one # check if we are already in a Tmux session or open/attach the default one
if [[ "${TERM-}" != tmux* ]] && [[ -z "${TMUX}" ]] && [[ -z "${SSH_CONNECTION}" ]] && command -v tmux 1> /dev/null; then if [[ "${TERM-}" != tmux* ]] && [[ -z "${TMUX}" ]] && [[ -z "${SSH_CONNECTION}" ]] && command -v tmux 1> /dev/null; then
# open/attach the local default Tmux session # open/attach the local default Tmux session
systemd-run -q --scope --user tmux new-session -A -s local && exit systemd-run -q --scope $([[ $(id -u) != 0 ]]; echo "--user") tmux new-session -A -s local && exit
elif [[ -z "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]] && command -v tmux 1> /dev/null; then elif [[ -z "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]] && command -v tmux 1> /dev/null; then
# open/attach the SSH default Tmux session # open/attach the SSH default Tmux session
systemd-run -q --scope --user tmux new-session -A -s ssh && exit systemd-run -q --scope $([[ $(id -u) != 0 ]]; echo "--user") tmux new-session -A -s ssh && exit
fi fi
# if Tmux is not installed or if we are inside a Tmux session continue the sourcing # if Tmux is not installed or if we are inside a Tmux session continue the sourcing

View file

@ -139,8 +139,8 @@ fi
# open/attach to a default tmux session named local or ssh # open/attach to a default tmux session named local or ssh
if command -v tmux 1> /dev/null; then if command -v tmux 1> /dev/null; then
alias tmux-local='systemd-run -q --scope --user tmux new-session -A -s local && exit' alias tmux-local='systemd-run -q --scope $([[ $(id -u) != 0 ]]; echo "--user") tmux new-session -A -s local && exit'
alias tmux-ssh='systemd-run -q --scope --user tmux new-session -A -s ssh && exit' alias tmux-ssh='systemd-run -q --scope $([[ $(id -u) != 0 ]]; echo "--user") tmux new-session -A -s ssh && exit'
fi fi
# vifm: tui file explorer # vifm: tui file explorer