#!/bin/bash ID=$(xdpyinfo | grep focus | cut -f4 -d " ") echo $ID PID=$(($(xprop -id $ID | grep -m 1 PID | cut -d " " -f 3)+7)) echo $PID if [ -e "/proc/$PID/cwd" ] then echo "right one" echo $(readlink /proc/$PID/cwd) alacritty --working-directory $(readlink /proc/$PID/cwd) --command /usr/bin/zsh & else alacritty --command /usr/bin/zsh fi