Personal project on my own time. However, if this works out half as well as it has thus far, I’ll make this official.
(Click image to see the video)
Off today, so just messing about. Testing the Framework eGPU switcher. Nothing glamorous, just something I put together using a little bash script, a launcher. I wasn’t thrilled about alternatives out there as I didn’t like how the user was left guessing what to do next.
Install.
Click an icon.
Choose a number.
Receive a clear confirmation that it switched.
Automatic logout so it can take affect once logged back in.
Works flawlessly on Ubuntu 22.04.1Wayland and Xorg using nvidia-prime.
So what’s wrong with egpu-switcher and others on Github? Nothing specifically, when they work. Also, some aren’t very clear if they worked or not. This works, with NVIDIA, well.
Not releasing the script yet as I want the install script to do the following:
UPDATED
Complete a bit more testing before releasing this.
Please make sure to not add unnecesary dependencies like systemd for systems/distros which do not use such.
Also, thanks for tinkering around with it! I am planning to get an eGPU as well, I will probably get the Razor Core X enclosure, but no idea which GPU yet.
Well folks, we have a winner. My simple script works really well, handles all the guesswork and heavy lifting. The first Framework NVIDIA eGPU Switcher tool is nearly ready.
It’s working!
When ready, this is tested on Ubuntu 22.04.1. Designed this to work on anything using apt, can also be configured for other packaging environments as well.
Installer script handles it all. Shortcuts, GPU detection, etc, all you do is use it.
So when you hit the icon, you are asked to press 1 or 2.
The whole thing is free of systemd or python or Go. Only expects libnotify, nvidia-prime, figlet, nvidia-driver-525-open, nvidia-prime and nvidia-settings. All super basic stuff.
The installer tool handles (Ubuntu) the installation of everything needed. You configure nothing.
All you need to do is access the tool from Activities.
This can be adjusted for NVIDIA or Intel with changes to notify-send --urgency=critical or notify-send --urgency=normal or notify-send --urgency=low. It’s just a script, easy to edit and customize.
Excellent project!!
It is using nvidia (or even nvidia-open) drivers, or nouveau drivers?
I have made many attempts at “adding” a nvidia Xorg provider (so that it appears in xrandr --lisproviders) without restarting X (and killing all X apps in the process), but I failed, and when I discovered it seemed to work OOTB in Ubuntu it was actually with nouveau (which seems to already handle this kind of hotplugging) not with nvidia.
Also, while Googpling, I saw attempts to add hotplugging support for amdgpu driver with a HotplugDriver X option.
All of that made me believe that some drivers (nouveau, maybe amdgpu) where hotpluggable, while others (nvidia) required a restart of the X server.
nvidia-driver-525-open is a metapackage. Head package is nvidia-driver-525. Not the FoSS Nvidia driver.
The secret sauce is to use the tech Nvidia has given us. Got the idea using the prime switcher applet in MATE. Worked so well, I made something in its spirit. But with some checks in place.
I see, many thanks!! I can’t wait to try it, and have an attempt at adapting it to my Artix distro!!
By the way, does it work even for hot-unplug? Ah you just answered that (hotpluging not yet tested)! Thx.
That would be very nice, to take out the laptop to the couch after a session using the eGPU, without having to close everything in the process!
Edit: oh, now I see that in your script there is a prompt asking to logout, which I think allows Xorg to restart. I had overlooked it. I believe that requires to close all running X apps beforehand? Not going to lie, my ultimate aim would be that there would be no need to logout anymore! And it seems that the nouveau drivers allows just that.
I wish I had more time to get this going, but it’s taken a backseat for the moment. It’s still “there” and will be worked on as time allows. But sadly, yes, time has gotten the better of me on this one. I am hoping to work on it during the weekends as I can. Needs a bit more testing before release - I will work to get it into beta soon for forum testing as time allows.