my .profile is filled with scripts like this. pasted below.
it allows a full screen desktop with out any other screens. at a dedicated tty.

but it has two issues. If there already is an connection i need to kill everuthing on the tty. 
And sometimes when i pkill -9 -t tty9 switch from client system the keyboard and mouse dont work. 
they do work after i rebooted the VM. 

I dont google stuff deeply and make it my self if i cant find it right away. 
So i might be doing it wrong.

anyway some one can help me with the two issues.

ps one bash question. I have an exit. but a right placed ctrl C can break to prompt i dont want that does some one know how i always run the program or exit to logout state.

Cheers.
bram


if [[ "$(tty)" == "/dev/tty10" ]]; then
   export XDG_RUNTIME_DIR=/run/user/$(id -u)/cage10
    
   while true; do
       # start agent if needed
       [ -z "$SSH_AUTH_SOCK" ] && eval "$(ssh-agent -s)" >/dev/null

       # load key if needed
       ssh-add -l >/dev/null 2>&1 || ssh-add ~/.ssh/id_rsa
        
       mkdir -p "$XDG_RUNTIME_DIR"
       chmod 700 "$XDG_RUNTIME_DIR"

       # Run virt-viewer
       cage -s -- virt-viewer \
           --domain-name vision \
           -c "qemu+ssh://bram@jack/system?ssh_compression=yes" \
           --attach -f \
           --auto-resize=always
        
       sleep 2
   done
   exit
fi