IT FUCKING WORKS

This commit is contained in:
Thomas Forgione 2024-06-21 18:16:54 +02:00
parent 62212e6b83
commit 90b5a8ad61
2 changed files with 17 additions and 5 deletions

View File

@ -3,8 +3,12 @@
WINDOW_ID=$(xdotool getactivewindow) WINDOW_ID=$(xdotool getactivewindow)
WM_NAME=$(xprop -id $WINDOW_ID WM_NAME | cut -d '"' -f 2) WM_NAME=$(xprop -id $WINDOW_ID WM_NAME | cut -d '"' -f 2)
uuid=$(uuidgen)
if [ -f $HOME/.config/terminalscwd/$WM_NAME.ssh ]; then if [ -f $HOME/.config/terminalscwd/$WM_NAME.ssh ]; then
alacritty -e sh -c "PARENT_TERMINAL=$WM_NAME ssh $(cat $HOME/.config/terminalscwd/$WM_NAME.ssh)" cp $HOME/.config/terminalscwd/$WM_NAME.ssh $HOME/.config/terminalscwd/$uuid.ssh
alacritty --title $uuid -e sh -c "TERMINAL_UUID=$uuid PARENT_TERMINAL=$WM_NAME ssh $(cat $HOME/.config/terminalscwd/$WM_NAME.ssh)"
else else
alacritty -e sh -c "PARENT_TERMINAL=$WM_NAME exec $SHELL" cp $HOME/.config/terminalscwd/$WM_NAME.pwd $HOME/.config/terminalscwd/$uuid.pwd
alacritty --title uuid -e sh -c "PARENT_TERMINAL=$WM_NAME exec $SHELL"
fi fi

View File

@ -1,7 +1,15 @@
if [ "$PRESERVE_SSH_CWD" = "true" ]; then if [ "$PRESERVE_SSH_CWD" = "true" ]; then
WINDOW_ID=$(xdotool getactivewindow) if [ -z $TERMINAL_UUID ]; then
WM_NAME=$(xprop -id $WINDOW_ID WM_NAME | cut -d '"' -f 2) if [ -z $DISPLAY ]; then
export TERMINAL_UUID=$WM_NAME export TERMINAL_UUID=$(uuidgen)
else
WINDOW_ID=$(xdotool getactivewindow)
WM_NAME=$(xprop -id $WINDOW_ID WM_NAME | cut -d '"' -f 2)
export TERMINAL_UUID=$WM_NAME
fi
fi
echo -en "\e]2;$TERMINAL_UUID\a"
mkdir -p $HOME/.config/terminalscwd/ mkdir -p $HOME/.config/terminalscwd/
cd() { cd() {
builtin cd $1 builtin cd $1