Define a list of applications to run with dGPU regardless of how they are initiated

System:
  Kernel: 6.13.8-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 14.2.1
    clocksource: tsc avail: hpet,acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=949f120b-6fda-47c9-8302-5cc39177e07b rw rootflags=subvol=@
    rd.luks.uuid=9d3e9398-8c28-4e4e-94ce-6270ff9d82ac loglevel=3 pci=noaer
    ibt=off
  Desktop: KDE Plasma v: 6.3.4 tk: Qt v: N/A info: frameworks v: 6.12.0
    wm: kwin_wayland vt: 1 dm: SDDM Distro: Garuda base: Arch Linux
Machine:
  Type: Laptop System: Micro-Star product: GE75 Raider 10SF v: REV:1.0
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: Micro-Star model: MS-17E9 v: REV:1.0 serial: <superuser required>
    part-nu: 17E9.1 uuid: <superuser required> UEFI: American Megatrends
    v: E17E9IMS.10D date: 11/17/2020
Battery:
  ID-1: BAT1 charge: 22.2 Wh (56.2%) condition: 39.5/51.6 Wh (76.7%)
    volts: 11.1 min: 10.9 model: MSI BIF0_9 type: Li-ion serial: N/A
    status: not charging
CPU:
  Info: model: Intel Core i7-10750H bits: 64 type: MT MCP arch: Comet Lake
    gen: core 10 level: v3 note: check built: 2020 process: Intel 14nm family: 6
    model-id: 0xA5 (165) stepping: 2 microcode: 0xFC
  Topology: cpus: 1x dies: 1 clusters: 6 cores: 6 threads: 12 tpc: 2
    smt: enabled cache: L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB
    desc: 6x256 KiB L3: 12 MiB desc: 1x12 MiB
  Speed (MHz): avg: 4860 min/max: 800/5000 scaling: driver: intel_pstate
    governor: powersave cores: 1: 4860 2: 4860 3: 4860 4: 4860 5: 4860 6: 4860
    7: 4860 8: 4860 9: 4860 10: 4860 11: 4860 12: 4860 bogomips: 62399
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel CometLake-H GT2 [UHD Graphics] vendor: Micro-Star MSI
    driver: i915 v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20
    ports: active: eDP-1 empty: none bus-ID: 00:02.0 chip-ID: 8086:9bc4
    class-ID: 0300
  Device-2: NVIDIA TU106M [GeForce RTX 2070 Mobile / Max-Q Refresh]
    vendor: Micro-Star MSI driver: nvidia v: 570.133.07
    alternate: nouveau,nvidia_drm non-free: 550/565.xx+ status: current (as
    of 2025-01; EOL~2026-12-xx) arch: Turing code: TUxxx process: TSMC 12nm FF
    built: 2018-2022 pcie: gen: 1 speed: 2.5 GT/s lanes: 16 link-max: gen: 3
    speed: 8 GT/s ports: active: none empty: DP-1,HDMI-A-1 bus-ID: 01:00.0
    chip-ID: 10de:1f14 class-ID: 0300
  Device-3: Bison HD Webcam driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-13:5 chip-ID: 5986:211c
    class-ID: 0e02
  Display: wayland server: X.org v: 1.21.1.16 with: Xwayland v: 24.1.6
    compositor: kwin_wayland driver: X: loaded: modesetting,nvidia
    unloaded: nouveau alternate: fbdev,intel,nv,vesa dri: iris gpu: i915
    display-ID: 0
  Monitor-1: eDP-1 model: ChiMei InnoLux 0x176e built: 2019 res:
    mode: 1920x1080 hz: 144 scale: 100% (1) dpi: 128 gamma: 1.2
    size: 381x214mm (15x8.43") diag: 437mm (17.2") ratio: 16:9
    modes: 1920x1080
  API: EGL v: 1.5 hw: drv: intel iris drv: nvidia nouveau drv: nvidia
    platforms: device: 0 drv: nvidia device: 1 drv: iris device: 2 drv: nouveau
    device: 3 drv: swrast gbm: drv: iris surfaceless: drv: nvidia wayland:
    drv: iris x11: drv: iris
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: intel mesa v: 25.0.3-arch1.1
    glx-v: 1.4 direct-render: yes renderer: Mesa Intel UHD Graphics (CML GT2)
    device-ID: 8086:9bc4 memory: 15.21 GiB unified: yes display-ID: :1.0
  API: Vulkan v: 1.4.309 layers: 14 device: 0 type: integrated-gpu
    name: Intel UHD Graphics (CML GT2) driver: N/A device-ID: 8086:9bc4
    surfaces: xcb,xlib,wayland device: 1 type: discrete-gpu
    name: NVIDIA GeForce RTX 2070 driver: N/A device-ID: 10de:1f14
    surfaces: xcb,xlib,wayland device: 2 type: cpu name: llvmpipe (LLVM
    19.1.7 256 bits) driver: N/A device-ID: 10005:0000
    surfaces: xcb,xlib,wayland
  Info: Tools: api: clinfo, eglinfo, glxinfo, vulkaninfo
    de: kscreen-console,kscreen-doctor gpu: corectrl, nvidia-settings,
    nvidia-smi wl: wayland-info x11: xdpyinfo, xprop, xrandr
Audio:
  Device-1: Intel Comet Lake PCH cAVS vendor: Micro-Star MSI
    driver: snd_hda_intel v: kernel alternate: snd_soc_avs,snd_sof_pci_intel_cnl
    bus-ID: 00:1f.3 chip-ID: 8086:06c8 class-ID: 0403
  Device-2: NVIDIA TU106 High Definition Audio vendor: Micro-Star MSI
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    bus-ID: 01:00.1 chip-ID: 10de:10f9 class-ID: 0403
  API: ALSA v: k6.13.8-zen1-1-zen status: kernel-api with: aoss
    type: oss-emulator tools: N/A
  Server-1: PipeWire v: 1.4.1 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Comet Lake PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 00:14.3 chip-ID: 8086:06f0 class-ID: 0280
  IF: wlo1 state: down mac: <filter>
  Device-2: Qualcomm Atheros Killer E2500 Gigabit Ethernet
    vendor: Micro-Star MSI driver: alx v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: 3000 bus-ID: 03:00.0 chip-ID: 1969:e0b1 class-ID: 0200
  IF: enp3s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Info: services: NetworkManager,systemd-timesyncd
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-14:6 chip-ID: 8087:0026
    class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.2
    lmp-v: 11 status: discoverable: no pairing: no class-ID: 6c010c
Drives:
  Local Storage: total: 1.84 TiB used: 405.54 GiB (21.5%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung
    model: MZVL21T0HCLR-00B00 size: 953.87 GiB block-size: physical: 512 B
    logical: 512 B speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: GXA7301Q temp: 44.9 C scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Seagate model: ST1000LM048-2E7172
    size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: HDD rpm: 5400 serial: <filter> fw-rev: 0001 scheme: GPT
Partition:
  ID-1: / raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
    used: 405.54 GiB (42.5%) fs: btrfs dev: /dev/dm-0 maj-min: 253:0
    mapped: luks-9d3e9398-8c28-4e4e-94ce-6270ff9d82ac
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 768 KiB (0.3%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
    used: 405.54 GiB (42.5%) fs: btrfs dev: /dev/dm-0 maj-min: 253:0
    mapped: luks-9d3e9398-8c28-4e4e-94ce-6270ff9d82ac
  ID-4: /var/log raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
    used: 405.54 GiB (42.5%) fs: btrfs dev: /dev/dm-0 maj-min: 253:0
    mapped: luks-9d3e9398-8c28-4e4e-94ce-6270ff9d82ac
  ID-5: /var/tmp raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
    used: 405.54 GiB (42.5%) fs: btrfs dev: /dev/dm-0 maj-min: 253:0
    mapped: luks-9d3e9398-8c28-4e4e-94ce-6270ff9d82ac
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 31.16 GiB used: 0 KiB (0.0%) priority: 100
    comp: zstd avail: lzo-rle,lzo,lz4,lz4hc,deflate,842 max-streams: 12
    dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 55.0 C pch: 62.0 C mobo: N/A
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 32 GiB available: 31.16 GiB used: 4.34 GiB (13.9%)
  Processes: 363 Power: uptime: 11m states: freeze,mem,disk suspend: deep
    avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
    suspend, test_resume image: 12.4 GiB services: org_kde_powerdevil,
    power-profiles-daemon, upowerd Init: systemd v: 257 default: graphical
    tool: systemctl
  Packages: pm: pacman pkgs: 1759 libs: 529 tools: octopi,paru Compilers:
    clang: 19.1.7 gcc: 14.2.1 Shell: garuda-inxi default: fish v: 4.0.1
    running-in: konsole inxi: 3.3.37
Garuda (2.7.2-1):
  System install date:     2025-03-12 (fresh install for the change to Wayland)
  Last full system update: 2025-04-04
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut nvidia-dkms
  Windows dual boot:       No/Undetected
  Failed units:            

I would like to set certain applications to always use the dGPU, regardless of how they are launched. I imagine having a list, in a .conf file, that contains programs that should always be run with prime-run (or otherwise be presented the dGPU as primary). For example. I always want Firefox to run on the NVIDIA dGPU. There is not ever a scenario, in my use-case, where I would want it to run on the iGPU. Same goes for mpv and a handful of others. I realize that I could prepend the Exec= line in a .desktop file with prime-run but that wouldn’t catch instances launched from another application, such as clicking on an external link in Steam.

I figured something would have a hook that would evaluate the application name and, when the app matched a name in the config, set the environment for that app the same as using prime-run would. Right now I’m resorting to prime-run firefox & from Konsole which is tedious and does not catch everything. I’ve found posts posing essentially the same question on several sites but they are either unanswered, suggest using DRI_PRIME=1, suggest using prime-run, or point to the arch wiki, which I did not find to have a relevant solution.

So the question is:
What can I do to have Firefox launch using the dGPU regardless of whether it was launched:

  • using firefox
  • using prime-run firefox
  • using a .desktop file
  • clicking a link in another application
  • any other way Firefox could be initiated.

hello patrioticparadox and welcome ,

im not sure yet but maybe you can write a script file and put into the bin folder with the correct right with the permissions :thinking:

something like that:

echo ‘#!/bin/bash
prime-run firefox’ > ~/bin/firefox-dgpu
chmod +x ~/bin/firefox-dgpu

The best way is to:

  1. Make a folder named custombin in your home directory.
  2. Make a script in that folder named firefox or the name of that program’s binary precisely (Make sure no .sh in the name, only the binary name).
  3. The contents of the script will be like:
#!/bin/bash
 prime-run /usr/bin/firefox

### Do not forget to make the script executable and dont copy this line or the triple hash ofc.
  1. Prepend that folder to your $PATH variable by:
    a. Editing the .bashrc in your home directory by editing that file with a text editor and add the following line at its very end:
    export PATH="/home/your_user/custombin:$PATH"

    And done. This is specific to your user only.

    b. Edit the /etc/profile file with a text editor and add the following line at very end:
    export PATH=/home/your_user/custombin:$PATH
    And done. This is system-wide (recommended)

Try and let me know. A login is required for changes to take effect.

Check if the $PATH variable modification is in effect with:
echo $PATH and see if your custom path is the first one.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.