Compare commits

...

3 Commits

Author SHA1 Message Date
Thomas Avé 2655195f7d Add firefox theme 2024-04-01 00:07:39 +02:00
Thomas Avé ef7854ae3f Add support for waypipe 2024-04-01 00:07:29 +02:00
Thomas Avé eb708dfa0a Use waypipe by default 2024-04-01 00:07:20 +02:00
4 changed files with 28 additions and 13 deletions

BIN
firefox/theme.xpi Normal file

Binary file not shown.

BIN
firefox/theme.zip Normal file

Binary file not shown.

View File

@ -1,21 +1,32 @@
#!/bin/bash
RUNNING_SSH=false
CHILD_PID=$(pgrep -P $1)
RUNNING_WAYPIPE=false
SSH_CLIENT=""
CHILD_PID=$(pgrep -P "$1")
[[ $(ps -p $CHILD_PID -o comm=) == "ssh" ]] && RUNNING_SSH=true
GRAND_CHILD_PID=$(pgrep -P $CHILD_PID)
[[ $? == 0 ]] && [[ $(ps -p $GRAND_CHILD_PID -o comm=) == "ssh" ]] && RUNNING_SSH=true && CHILD_PID=$GRAND_CHILD_PID
GRAND_CHILD_PID=$(pgrep -P "$CHILD_PID")
if [ "$GRAND_CHILD_PID" != 0 ]; then
GRAND_CHILD_NAME=$(ps -p "$GRAND_CHILD_PID" -o comm=)
if [ "$GRAND_CHILD_NAME" == "ssh" ]; then
RUNNING_SSH=true
CHILD_PID=$GRAND_CHILD_PID
SSH_CLIENT=$(ps -p "$CHILD_PID" -o args --no-headers | awk '{ print $2 }')
fi
if [ "$GRAND_CHILD_NAME" == "waypipe" ]; then
RUNNING_WAYPIPE=true
CHILD_PID=$(pgrep -P "$GRAND_CHILD_PID")
SSH_CLIENT=$(ps -p "$GRAND_CHILD_PID" -o args --no-headers | awk '{ print $3 }')
fi
fi
if [ $RUNNING_SSH == true ]; then
CLIENT=$(ps -p $CHILD_PID -o args --no-headers | awk '{ print $2 }')
if [ $RUNNING_SSH == true ] || [ $RUNNING_WAYPIPE == true ]; then
PORT=$(ss -tnpa | grep ssh | grep "pid=$CHILD_PID" | awk '{ print $4 }' | grep -o '[0-9]*$')
alacritty -e ssh $CLIENT -t "cd \"\$(readlink -e /proc/\$(cat /tmp/ssh_session_$PORT)/cwd)\"; zsh --login"
alacritty -e ssh "$SSH_CLIENT" -t "cd \"\$(readlink -e /proc/\$(cat /tmp/ssh_session_$PORT)/cwd)\"; zsh --login"
else
if [ "$(ps -p $1 -o comm=)" == "alacritty" ]; then
CWD=$(readlink -e /proc/$CHILD_PID/cwd)
if [ "$(ps -p "$1" -o comm=)" == "alacritty" ]; then
CWD=$(readlink -e /proc/"$CHILD_PID"/cwd)
if [ "$CWD" != "" ]; then
alacritty --working-directory "$CWD"
else

View File

@ -153,6 +153,10 @@ function zvm_after_init() {
bindkey -M emacs "^Y" find_local_files
bindkey -M vicmd "^Y" find_local_files
bindkey -M viins "^Y" find_local_files
if [ "$REMOTE_PATH" != "" ]; then
cd $REMOTE_PATH
fi
}
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
@ -221,12 +225,12 @@ function o () {
xdg-open "$1" &!
}
function s() {
ssh server@mallorea -t "cd \"$(pwd)\" ; zsh --login"
function server() {
waypipe ssh -t mallorea env REMOTE_PATH="$(pwd)" "zsh --login"
}
function riva() {
ssh user@riva -t "cd \"$(pwd)\" ; zsh --login"
waypipe ssh -t riva env REMOTE_PATH="$(pwd)" "zsh --login"
}
if [ "$SSH_CLIENT" ]