This commit is contained in:
Thomas Forgione 2024-06-21 18:40:01 +02:00
parent 90b5a8ad61
commit 6e63a19f04
2 changed files with 11 additions and 5 deletions

View File

@ -4,11 +4,12 @@ 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) uuid=$(uuidgen)
notify-send $WM_NAME you
if [ -f $HOME/.config/terminalscwd/$WM_NAME.ssh ]; then if [ -f $HOME/.config/terminalscwd/$WM_NAME.ssh ]; then
cp $HOME/.config/terminalscwd/$WM_NAME.ssh $HOME/.config/terminalscwd/$uuid.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)" alacritty --title $uuid -e sh -c "TERMINAL_UUID=$uuid PARENT_TERMINAL=$WM_NAME ssh $(cat $HOME/.config/terminalscwd/$WM_NAME.ssh)"
else else
cp $HOME/.config/terminalscwd/$WM_NAME.pwd $HOME/.config/terminalscwd/$uuid.pwd cp $HOME/.config/terminalscwd/$WM_NAME.pwd $HOME/.config/terminalscwd/$uuid.pwd
alacritty --title uuid -e sh -c "PARENT_TERMINAL=$WM_NAME exec $SHELL" alacritty --title $uuid -e sh -c "TERMINAL_UUID=$uuid PARENT_TERMINAL=$WM_NAME exec $SHELL"
fi fi

View File

@ -1,11 +1,16 @@
if [ "$PRESERVE_SSH_CWD" = "true" ]; then if [ "$PRESERVE_SSH_CWD" = "true" ]; then
if [ -z $TERMINAL_UUID ]; then if [ -z $DISPLAY ]; then
if [ -z $DISPLAY ]; then if [ -z $TERMINAL_UUID ]; then
export TERMINAL_UUID=$(uuidgen) export TERMINAL_UUID=$(uuidgen)
else fi
WINDOW_ID=$(xdotool getactivewindow) else
WINDOW_ID=$(xdotool getactivewindow)
if [ $? -eq 0 ]; then
WM_NAME=$(xprop -id $WINDOW_ID WM_NAME | cut -d '"' -f 2) WM_NAME=$(xprop -id $WINDOW_ID WM_NAME | cut -d '"' -f 2)
export TERMINAL_UUID=$WM_NAME export TERMINAL_UUID=$WM_NAME
else
export TERMINAL_UUID=$(uuidgen)
fi fi
fi fi
echo -en "\e]2;$TERMINAL_UUID\a" echo -en "\e]2;$TERMINAL_UUID\a"