Skip to content

Instantly share code, notes, and snippets.

@jmkelly
Created December 11, 2023 03:00
Show Gist options
  • Save jmkelly/809ae0c941ee0ef71c7301b4c27e3161 to your computer and use it in GitHub Desktop.
Save jmkelly/809ae0c941ee0ef71c7301b4c27e3161 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Replace these values with your actual setup
DISPLAY_NAME="HDMI-1"
WIDTH=2560
HEIGHT=1080
CUSTOM_MODE_NAME="${WIDTH}x${HEIGHT}"
# Use cvt to generate modeline data
MODELINEDATA=$(cvt $WIDTH $HEIGHT | grep Modeline | cut -d' ' -f4-)
# Add custom mode
xrandr --newmode "$CUSTOM_MODE_NAME" $MODELINEDATA
xrandr --addmode $DISPLAY_NAME "$CUSTOM_MODE_NAME"
# Apply the new resolution
xrandr --output $DISPLAY_NAME --mode "$CUSTOM_MODE_NAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment