Peppermint | Linux OS Community Forum
 
It is currently Sat Dec 16, 2017 10:22 pm

All times are UTC - 5 hours [ DST ]





Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: A simple script to test xrandr's screen resolution
PostPosted: Thu Jun 03, 2010 10:24 am 
Offline
User avatar

Joined: Wed May 19, 2010 5:11 pm
Posts: 958
Location: Asheville, North Carolina
Class: Screen configuration tip
Difficulty: Write a script and know to use it; some caution advised
Time: Just a few minutes
Desirability: Great for testing out screen resolutions!

As you may or may not know xrandr is a program that allows you to set your monitors screen resolution. It dose a really good job at it but there is just one thing that it dose that I do not like, it dose not give you time to test and see if is what you want it sets the resolution right away. The following script adds a 20 wait time to xrandr so you can see if that is the resolution that you are looking for.
WARNING!! Even though this script has been tested and approved there is still a chance that it will not work depending on you graphics cards or your monitors refresh rate.

Code:
#!/bin/sh
# Temporarily change resolutions (great for testing)
# Example usage: ./testres -s 1   (to set to xrandr screensetting #1)

# Save current resolution
Resolution=`xrandr -q | grep '*' | awk -F'*' '{print $2} | \
            awk '{print $2 $3 $4}'`
Rate=`xrandr -q | grep '*' | awk -F'*' '{print $3}' | awk '{print $1}'`
echo "Old: Resolution $Resolution Refresh rate: $Rate Hz"

#Set the resolution using the command-line options.
xrandr $*
echo "New: `xrandr -q | grep '*'`"

#Wait 20 seconds, then change back
sleep 20
zrandr -s $Resolution -r Rate
echo "Switching back"
echo "Current: `xrandr -q | grep '*'`"


If you like the resolution then press Ctrl+C to kill the script. I used gedit to write the script but you can use which ever one you prefer.

_________________
Support Team Leader
Co-Creator of Lubuntu x86_64

I'm on Twitter: @Asheguy
I'm on identi.ca: http://identi.ca/asheguy

Linux User #507486


Top
 Profile  
 
 

Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

Powered by php B.B. © 2000, 2002, 2005, 2007 php B.B. Group
Template made by DEVPPL