about summary refs log tree commit diff
path: root/dotfiles
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-08-20 19:42:21 +0200
committerBaitinq <[email protected]>2025-08-20 19:42:21 +0200
commit731e4609391cf2bac73141d0956868281c07ebc7 (patch)
tree85846999367bbd3d94af0c362506147e4f51dd65 /dotfiles
parentHosts: Add hf package (diff)
downloadnixos-config-731e4609391cf2bac73141d0956868281c07ebc7.tar.gz
nixos-config-731e4609391cf2bac73141d0956868281c07ebc7.tar.bz2
nixos-config-731e4609391cf2bac73141d0956868281c07ebc7.zip
Hardware: PC: Set high refresh rate automatically
Diffstat (limited to 'dotfiles')
-rw-r--r--dotfiles/.xinitrc16
1 files changed, 15 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