I have a laptop with two GPUs that's running Linux Mint with the cinnamon de. I created a primitive script that I set to run at boot via systemctl, which sets the active GPU to nvidia if AC power is detected, otherwise it sets the GPU to intel. The script is as follows:
#!/bin/sh read -r online<"/sys/class/power_supply/AC0/online" if [ "$online" = '1' ]; then prime-select nvidia else prime-select intel fi
Now, if I boot my computer on battery, it successfully sets the GPU to intel and I am able to log in without any issues, however when I attempt to log in when it was supposed to switch the GPU from intel to nvidia, cinnamon crashes. The only way I can get cinnamon to work after that is by logging out and logging back in. This doesn't happen if nvidia was the selected GPU already, it only happens if it's switching from intel to nvidia. Here's the systemd log: pastebin.com/BtMHknXf
Any and all help appreciated, thanks!