about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--dotfiles/.xinitrc16
-rw-r--r--hardware/pc/hardware.nix1
2 files changed, 16 insertions, 1 deletions
diff --git a/dotfiles/.xinitrc b/dotfiles/.xinitrc
index 44cbad2..f8d567e 100644
--- a/dotfiles/.xinitrc
+++ b/dotfiles/.xinitrc
@@ -37,7 +37,21 @@ fi
 
 # NEEDED FOR NVIDIA DRIVERS
 if [ -x "$(command -v nvidia-smi)" ]; then
-  xrandr --setprovideroutputsource modesetting NVIDIA-0
+
+  # Preferred resolution + refresh rate
+  RES="3440x1440"
+  RATE="160.00"
+
+  # Find a connected display (DP-2, HDMI-0, etc.)
+  OUTPUT="$(xrandr | grep " connected" | cut -d' ' -f1)"
+
+  # Only switch if the mode exists
+  if xrandr | grep -qE "${RES}"; then
+    xrandr --output "$OUTPUT" --mode "$RES" --rate "$RATE"
+  else
+    # For PRIME / hybrid setups
+    xrandr --setprovideroutputsource modesetting NVIDIA-0
+   fi
 fi
 
 # NEEDED FOR CHROMEBOOK
diff --git a/hardware/pc/hardware.nix b/hardware/pc/hardware.nix
index 9eac0d0..da6df7b 100644
--- a/hardware/pc/hardware.nix
+++ b/hardware/pc/hardware.nix
@@ -43,6 +43,7 @@ in {
       modesetting.enable = true;
       open = true;
       nvidiaSettings = true;
+      package = config.boot.kernelPackages.nvidiaPackages.stable;
     };
   };