make nvidia environment variables conditional

This commit is contained in:
krolyxon 2026-01-13 20:44:06 +05:30
parent 15264a6db2
commit 650f52140f
2 changed files with 17 additions and 2 deletions

View File

@ -15,8 +15,11 @@ env = QT_QPA_PLATFORM,wayland;xcb # Qt: Use Wayland if available, fall back to
env = SDL_VIDEODRIVER,Wayland # Run SDL2 applications on Wayland. Remove or set to x11 if games that provide older versions of SDL cause compatibility issues env = SDL_VIDEODRIVER,Wayland # Run SDL2 applications on Wayland. Remove or set to x11 if games that provide older versions of SDL cause compatibility issues
env = CLUTTER_BACKEND,wayland # Clutter applications to try and use the Wayland backend env = CLUTTER_BACKEND,wayland # Clutter applications to try and use the Wayland backend
# Nvidia # Force NVIDIA as primary GPU
# env = GBM_BACKEND,nvidia-drm # env = __NV_PRIME_RENDER_OFFLOAD,1
# env = __GLX_VENDOR_LIBRARY_NAME,nvidia # env = __GLX_VENDOR_LIBRARY_NAME,nvidia
# env = __VK_LAYER_NV_optimus,NVIDIA_only
# env = GBM_BACKEND,nvidia-drm
# env = WLR_NO_HARDWARE_CURSORS,1
# env = LIBVA_DRIVER_NAME,nvidia # env = LIBVA_DRIVER_NAME,nvidia

View File

@ -53,6 +53,18 @@ export PATH="$PATH:$XDG_DATA_HOME/cargo/bin"
export MPD_HOST="localhost" export MPD_HOST="localhost"
export MPD_PORT="6600" export MPD_PORT="6600"
# Force NVIDIA as primary GPU, if envycontrol mode is set to nvidia
MODE=$(envycontrol -q)
if [[ $MODE = "nvidia" ]]; then
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
export GBM_BACKEND=nvidia-drm
export WLR_NO_HARDWARE_CURSORS=1
export LIBVA_DRIVER_NAME=nvidia
fi
# Mpd daemon start # Mpd daemon start
[ ! -s ~/.config/mpd/pid ] && mpd [ ! -s ~/.config/mpd/pid ] && mpd