From 2ddc7c2f51588f5764c0d2c648543819d20b4c56 Mon Sep 17 00:00:00 2001 From: thek4n Date: Thu, 4 Apr 2024 11:07:38 +0300 Subject: [PATCH] style(tmux); ref(bashfuncs) --- home/user/.config/bash/functions | 24 +++++++++++++++--------- home/user/.config/tmux/style.conf | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/home/user/.config/bash/functions b/home/user/.config/bash/functions index 25e6972..6847169 100644 --- a/home/user/.config/bash/functions +++ b/home/user/.config/bash/functions @@ -23,7 +23,7 @@ destroy() { } workon() { - source /opt/pythonenv/"${1:-$(basename $PWD)}"/bin/activate + source "/opt/pythonenv/${1:-$(basename $PWD)}/bin/activate" } py() { @@ -122,24 +122,30 @@ vpn() { CONFIGFILE="/etc/wireguard/$CONFIG.conf" - test -e "$CONFIGFILE" || (echo "Config '$CONFIGFILE' not exists" >&2; return 1) && ( + if [ ! -e "$CONFIGFILE" ]; then + echo "Config '$CONFIGFILE' not exists" >&2 + return 1 + fi - SERVICE="wg-quick@$CONFIG.service" + SERVICE="wg-quick@$CONFIG.service" - systemctl --quiet is-active "$SERVICE" && \ - (sudo systemctl stop "$SERVICE" && echo DOWN) || \ - (sudo systemctl start "$SERVICE" && ip -br a | grep "$CONFIG" | awk '{print $1":\t"$3}') - ) + if systemctl --quiet is-active "$SERVICE"; then + sudo systemctl stop "$SERVICE" + echo "DOWN" + else + sudo systemctl start "$SERVICE" && ip -br a | grep "$CONFIG" | awk '{print $1":\t"$3}' + fi } toggle-ssh-proxy() { - SSH_PROXY_CONTROL_FILE="$XDG_RUNTIME_DIR/ssh_$1_proxy.control" - if [ -z "$1" ]; then echo "Proxy ssh server hostname not specified" 1>&2 return 1 fi + SSH_PROXY_CONTROL_FILE="$XDG_RUNTIME_DIR/ssh_${1}_proxy.control" + + if [ -e "$SSH_PROXY_CONTROL_FILE" ]; then unset {http,https,ftp,rsync,no}_proxy ssh -S "$SSH_PROXY_CONTROL_FILE" -O exit "$1" diff --git a/home/user/.config/tmux/style.conf b/home/user/.config/tmux/style.conf index 5d279c6..7c1661b 100644 --- a/home/user/.config/tmux/style.conf +++ b/home/user/.config/tmux/style.conf @@ -10,7 +10,7 @@ set -g status-style 'bg=default,fg=white' set -g status-justify centre # center windows in statusline set -g status-left-length 40 set -g status-left "#S@#H" -set -g status-right '%d.%m.%Y %H:%M' +set -g status-right '%d.%m.%Y %a %H:%M' set -g window-status-style 'bg=default' set -g window-status-current-style 'bg=white,fg=black bold' set -g window-status-format '#W#{?window_flags,#{window_flags}, }'