Skip to content

Instantly share code, notes, and snippets.

@betapictoris
Created November 19, 2024 18:23
Show Gist options
  • Save betapictoris/a92093e835baeb35e2ead68bf8a9b0fd to your computer and use it in GitHub Desktop.
Save betapictoris/a92093e835baeb35e2ead68bf8a9b0fd to your computer and use it in GitHub Desktop.
Script to set the resolution to input
## setResolution.sh - 2024-11-19
##
## Example:
## bash ./setResolution.sh 1410 940
##
# Get the string for the mode
mode="$(cvt $1 $2 | sed -n '2,2p' | sed 's/Modeline //g')"
name="$(echo $mode | grep -o "^\".*\"")"
echo $name
# Create and set the mode
xrandr --newmode $mode
xrandr --addmode eDP-1 $name
xrandr --output eDP-1 --mode $name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment