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.
- 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.1 Wayland 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:
- 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.
Agreed. All that is installed is:
libnotify, nvidia-prime, figlet, nvidia-driver-525-open, nvidia-prime and nvidia-settings. All super basic stuff.
I used figlet for the fun text telling us “clearly” that the switch worked.
Part of what turned me off from alternatives was needing systemd and “Go.”
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.
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.
Then I am automatically prompted to logout.
Logging back in (Wayland or Xorg, doesn’t matter). The tool pings nvidia-smi
If Nvidia is active, it tells me NVIDIA. If not, I get Intel.
So this is super bloaty, right? Nope.
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.
- Or add it to your favorites from Activities for easier access.
Switching back to Intel.
Log out as prompted.
Then upon logging back in, rock solid CONFIRMATION that I am using Intel by not assuming, but actually checking to make sure.
then I can see it. I did it this way as I care less about being notified.
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.
Nice! When the code is released I’ll try to add support for AMD.
Outstanding! Will let you know. Appreciate the assist!
It is using
nvidia (or even
nvidia-open) drivers, or
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
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 (
amdgpu) where hotpluggable, while others (
nvidia) required a restart of the X server.
But now with your project I hope I was wrong!!?
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 have not tested hotpluging.
Still in testing phase atm.
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.
Yeah, not needing to logout is an ultimate goal. The logout was used for xorg and Wayland.
My primary focus is making sure it works. If logging out is the price I have to pay, I’m perfectly fine with it.
My goal is simplicity with reliability. So that’s the first order I’m working on.
Love this, the biggest annoyance for me is that I have to reboot when switching to my AMD eGPU.
Can’t wait to see where this lands
Is this script almost ready for release? Would love to test it out
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.