style(tmux); ref(bashfuncs)

This commit is contained in:
thek4n 2024-04-04 11:07:38 +03:00
parent 57887a7c83
commit 2ddc7c2f51
2 changed files with 16 additions and 10 deletions

View File

@ -23,7 +23,7 @@ destroy() {
} }
workon() { workon() {
source /opt/pythonenv/"${1:-$(basename $PWD)}"/bin/activate source "/opt/pythonenv/${1:-$(basename $PWD)}/bin/activate"
} }
py() { py() {
@ -122,24 +122,30 @@ vpn() {
CONFIGFILE="/etc/wireguard/$CONFIG.conf" 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" && \ if systemctl --quiet is-active "$SERVICE"; then
(sudo systemctl stop "$SERVICE" && echo DOWN) || \ sudo systemctl stop "$SERVICE"
(sudo systemctl start "$SERVICE" && ip -br a | grep "$CONFIG" | awk '{print $1":\t"$3}') echo "DOWN"
) else
sudo systemctl start "$SERVICE" && ip -br a | grep "$CONFIG" | awk '{print $1":\t"$3}'
fi
} }
toggle-ssh-proxy() { toggle-ssh-proxy() {
SSH_PROXY_CONTROL_FILE="$XDG_RUNTIME_DIR/ssh_$1_proxy.control"
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "Proxy ssh server hostname not specified" 1>&2 echo "Proxy ssh server hostname not specified" 1>&2
return 1 return 1
fi fi
SSH_PROXY_CONTROL_FILE="$XDG_RUNTIME_DIR/ssh_${1}_proxy.control"
if [ -e "$SSH_PROXY_CONTROL_FILE" ]; then if [ -e "$SSH_PROXY_CONTROL_FILE" ]; then
unset {http,https,ftp,rsync,no}_proxy unset {http,https,ftp,rsync,no}_proxy
ssh -S "$SSH_PROXY_CONTROL_FILE" -O exit "$1" ssh -S "$SSH_PROXY_CONTROL_FILE" -O exit "$1"

View File

@ -10,7 +10,7 @@ set -g status-style 'bg=default,fg=white'
set -g status-justify centre # center windows in statusline set -g status-justify centre # center windows in statusline
set -g status-left-length 40 set -g status-left-length 40
set -g status-left "#S@#H" 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-style 'bg=default'
set -g window-status-current-style 'bg=white,fg=black bold' set -g window-status-current-style 'bg=white,fg=black bold'
set -g window-status-format '#W#{?window_flags,#{window_flags}, }' set -g window-status-format '#W#{?window_flags,#{window_flags}, }'