How to switch the primary GPU to NVIDIA on Wayland for KDE Plasma and GNOME

Most distributions use the computer's built-in GPU (e.g., AMD or Intel) by default, so this tutorial includes a quick guide to switch the primary GPU from Wayland to an NVIDIA GPU.
This tutorial was tested in the most popular Linux desktop environments used by the most popular Linux users - GNOME and KDE Plasma. However, if another desktop environment uses KWin as its compositor or Mutter as its window manager for GNOME, this tutorial should also work.
This tutorial is recommended for people using Wayland by default. If you want to change an X11/Xorg session or switch the primary GPU to an NVIDIA GPU, please refer to my tutorial on "How to Connect External Monitors to Your Linux Laptop (Solving HDMI 'No Signal' Issues)".
The basic requirement is either passing environment variables or setting up udev rules. However, first, run the following command in your favorite terminal emulator to check which GPU your system is currently using:
glxinfo | egrep "OpenGL vendor|OpenGL renderer"
Switching the Default GPU to NVIDIA in GNOME
For the GNOME desktop environment, you need to create a new file named 61-mutter-primary-gpu.rules in the /etc/udev/rules.d/ directory. To do this, run the following command in your favorite terminal app (using GNU nano editor or your preferred command-line editor if installed):
sudo nano /etc/udev/rules.d/61-mutter-primary-gpu.rules
This command will create a 61-mutter-primary-gpu.rules file and open it with GNU nano, where you can paste the following udev rule to switch the primary GPU to NVIDIA. However, not all distributions have /usr/lib/udev/rules.d directory, so adjust the command accordingly to find the correct directory.
ENV{DEVNAME}=="/dev/dri/card0", TAG+="mutter-device-preferred-primary"
In the above udev rule, /dev/dri/card0 refers to the NVIDIA GPU in your system. To check the location of the GPU, run the following command in your terminal emulator. The first command shows each GPU's PCI number (e.g., card0 is 01:00.0, card1 is 05:00.0, etc.).
ls -l /dev/dri/by-path/
The second command can be used to identify which GPU based on the PCI number is a card0. Therefore, by running these two commands, we know that the NVIDIA GPU has a PCI number of 01:00.0 and is referred to as card0.
lspci -k | grep -EA3 'VGA|3D|Display'
Switching the Default GPU to NVIDIA in KDE Plasma
For the KDE Plasma desktop environment, you need to create a directory named .config/environment.d/. Additionally, you need to create a file named 90-nvidia.conf within this directory. Run the following commands: The first command creates the directory, and the second command creates the configuration file.
mkdir ~/.config/environment.d/
nano ~/.config/environment.d/90-nvidia.conf
Now, paste the following line into the environment.d/90-nvidia.conf file, save it, and close nano:
__NV_PRIME_RENDER_OFFLOAD=1
__GLX_VENDOR_LIBRARY_NAME=nvidia
__VK_LAYER_NV_optimus=NVIDIA_only
That's it. Now reboot your computer to set the NVIDIA graphics card as the primary GPU in Wayland. You can check this through the command line or by using a system settings app to confirm that the graphics card is an NVIDIA one.

카테고리
최신 글
- Satechi 키보드 SM3 메커니컬 키보드 리뷰: 조용하고 생산성에 완벽합니다.
- 이 오래된 휴대 전화가 나의 앞에서 화재 위험으로 변했다.
- 애플에서 초대하는 방법 10가지와 애플 캘린더의 차이점"
- Apple @ Work: Will Apple launch a Google Workspace competitor in 2025?
- Apple, iPhone SE 4 발표를 위한 특별 이벤트 개최 가능성이 낮다.
- 오늘 뉴욕 타임즈 연결(Connections)의 힌트와 정답 (2월 8일, #608)
- Ubuntu 20.04 LTS 지원이 종료될 예정입니다.
- 읽는 사람이 있으신가요? AI가 당신을 위해 읽어드리겠습니다.
- This is my Blu-ray player.
- 새로운 애플 제품이 다음 주에 출시될 예정입니다. 다음이 출시될 예정입니다.
최신 태그
- Slim SM3
- fire risk
- disposal
- damaged
- ithium-ion battery
- Visual Appeal
- Enterprise
- Collaboration
- AI voice
- Speechify