dotfiles/bin/clone-terminal

20 lines
460 B
Bash
Executable File

#!/usr/bin/env bash
# Extract parent window uuid
# On hyprland
hyprctl monitors > /dev/null 2>&1
if [ $? -eq 0 ]; then
WM_NAME=$(hyprctl activewindow | grep title | cut -d ':' -f 2 | tr -d ' ')
else
WINDOW_ID=$(xdotool getactivewindow)
WM_NAME=$(xprop -id $WINDOW_ID WM_NAME | cut -d '"' -f 2)
fi
# Generate new uuid for new terminal
uuid=$(uuidgen)
alacritty --title $uuid -e sh -c "TERMINAL_UUID=$uuid PARENT_TERMINAL=$WM_NAME exec $SHELL"