I have a game called Xonotic installed and I followed this website instructions to start the game with the GPU:
DRI_PRIME=1 xonotic-glx
But after I do that, my screensaver and taskbar disappears and I am left with a black screen. I can see existing windows but can no longer access the menu bar and have to restart the device.
provide formated output of: inxi -Fazy
try again running the game and when the game freezes try entering TTY by pressing as stephane sugested ctrl + alt + f2 - if f2 doesnt work try f1-f6 keys instead - if it worked, use this command: journalctl --boot=0 --priority=5 --no-pager - it will show logs, so check them for some hints
you can reboot from tty with this command: systemctl reboot