If this turns up empty, and id is tty1 (the variable should be renamed tty, btw), then you can do something like the following:
```
process="`ps -o tty=,pid= -C X | awk '$1=="?" {print $2; exit}`"
```