requested changes

This commit is contained in:
Kn0ax
2025-06-30 20:45:17 +02:00
parent b5dfaef8bb
commit 188d1c331a
2 changed files with 10 additions and 37 deletions

View File

@ -3,20 +3,5 @@ yay -S --noconfirm --needed \
wofi waybar mako swaybg \ wofi waybar mako swaybg \
xdg-desktop-portal-hyprland xdg-desktop-portal-gtk xdg-desktop-portal-hyprland xdg-desktop-portal-gtk
# Checks if nvidia gpu exist
gpu_info=$(lspci | grep -i 'nvidia')
if [ -n "$gpu_info" ]; then
# Ask user if they want to install NVIDIA drivers
if [ -t 0 ]; then
read -p "NVIDIA GPU detected. Do you want to install NVIDIA drivers? (y/N) " install_nvidia
if [[ "$install_nvidia" =~ ^[yY](es)?$ ]]; then
source ~/.local/share/omarchy/install/nvidia
fi
else
# Non-interactive mode - run nvidia script
source ~/.local/share/omarchy/install/nvidia
fi
fi
# Start Hyprland on first session # Start Hyprland on first session
echo "[[ -z \$DISPLAY && \$(tty) == /dev/tty1 ]] && exec Hyprland" >~/.bash_profile echo "[[ -z \$DISPLAY && \$(tty) == /dev/tty1 ]] && exec Hyprland" >~/.bash_profile

View File

@ -1,5 +1,3 @@
#!/bin/bash
# ============================================================================== # ==============================================================================
# Hyprland NVIDIA Setup Script for Arch Linux # Hyprland NVIDIA Setup Script for Arch Linux
# ============================================================================== # ==============================================================================
@ -10,16 +8,20 @@
# #
# ============================================================================== # ==============================================================================
# --- GPU Detection ---
# Check if nvidia gpu exists, exit silently if not found
gpu_info=$(lspci | grep -i 'nvidia')
if [ -z "$gpu_info" ]; then
exit 0
fi
# --- Colors for better readability --- # --- Colors for better readability ---
C_RESET='\033[0m' C_RESET='\033[0m'
C_RED='\033[0;31m' C_RED='\033[0;31m'
C_YELLOW='\033[0;33m' C_YELLOW='\033[0;33m'
C_BOLD='\033[1m' C_BOLD='\033[1m'
# --- GPU Detection and Driver Selection --- # --- Driver Selection ---
# Get GPU info for driver selection
gpu_info=$(lspci | grep -i 'nvidia')
# Turing (16xx, 20xx), Ampere (30xx), Ada (40xx), and newer recommend the open-source kernel modules # Turing (16xx, 20xx), Ampere (30xx), Ada (40xx), and newer recommend the open-source kernel modules
if echo "$gpu_info" | grep -q -E "RTX [2-9][0-9]|GTX 16"; then if echo "$gpu_info" | grep -q -E "RTX [2-9][0-9]|GTX 16"; then
NVIDIA_DRIVER_PACKAGE="nvidia-open-dkms" NVIDIA_DRIVER_PACKAGE="nvidia-open-dkms"
@ -60,19 +62,11 @@ if ! yay -Syu --needed --noconfirm "${PACKAGES_TO_INSTALL[@]}"; then
fi fi
# Configure modprobe for early KMS # Configure modprobe for early KMS
if ! echo "options nvidia_drm modeset=1" | sudo tee /etc/modprobe.d/nvidia.conf >/dev/null; then echo "options nvidia_drm modeset=1" | sudo tee /etc/modprobe.d/nvidia.conf >/dev/null
echo -e "${C_RED}${C_BOLD}[ERROR]${C_RESET} Failed to configure modprobe. Please check your permissions." >&2
exit 1
fi
# Configure mkinitcpio for early loading # Configure mkinitcpio for early loading
MKINITCPIO_CONF="/etc/mkinitcpio.conf" MKINITCPIO_CONF="/etc/mkinitcpio.conf"
if [ ! -f "$MKINITCPIO_CONF" ]; then
echo -e "${C_RED}${C_BOLD}[ERROR]${C_RESET} $MKINITCPIO_CONF not found. Aborting." >&2
exit 1
fi
# Define modules # Define modules
NVIDIA_MODULES="nvidia nvidia_modeset nvidia_uvm nvidia_drm" NVIDIA_MODULES="nvidia nvidia_modeset nvidia_uvm nvidia_drm"
@ -97,14 +91,8 @@ if [ -f "$HYPRLAND_CONF" ]; then
cat >> "$HYPRLAND_CONF" << 'EOF' cat >> "$HYPRLAND_CONF" << 'EOF'
# NVIDIA environment variables # NVIDIA environment variables
env = ELECTRON_OZONE_PLATFORM_HINT,auto
env = NVD_BACKEND,direct env = NVD_BACKEND,direct
env = LIBVA_DRIVER_NAME,nvidia env = LIBVA_DRIVER_NAME,nvidia
env = __GLX_VENDOR_LIBRARY_NAME,nvidia env = __GLX_VENDOR_LIBRARY_NAME,nvidia
EOF EOF
fi fi
# Final information
echo -e "${C_YELLOW}${C_BOLD}IMPORTANT:${C_RESET} A reboot is required for all changes to take effect."