|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Search this Thread |
|
#1
|
|||
|
|||
|
How to get current X screen resolution
Hi,
I need to get the current X*Y resolution of X in a shell script. xrandr -q gives me a line like this: Screen 0: minimum 320 x 200, current 1600 x 1200, maximum 3080 x 1600 How can I extract the X and Y current resolution values? sed, awk, cut or any other console solution is welcomed. Thanks |
| Sponsored Links | ||
|
|
|
#2
|
||||
|
||||
|
The output from xdpyinfo(1) also includes amongst many other things the line: Code:
dimensions: 1280x800 pixels (301x192 millimeters) that provides what you want, as long as you have only 1 screen. But using xrandr(1) the following would do the trick: Code:
$ cat ./xrandr_test.sh
LINE=`xrandr -q | grep Screen`
echo LINE = ${LINE}
WIDTH=`echo ${LINE} | awk '{ print $8 }'`
echo WIDTH = ${WIDTH}
HEIGHT=`echo ${LINE} | awk '{ print $10 }' | awk -F"," '{ print $1 }'`
echo HEIGHT = ${HEIGHT}
$ ./xrandr_test.sh
LINE = Screen 0: minimum 320 x 240, current 1280 x 800, maximum 1280 x 800
WIDTH = 1280
HEIGHT = 800
$Last edited by TonyFullerMalv; 12-24-2009 at 02:24 PM.. |
|
#3
|
|||
|
|||
|
Thank you. This solves my problem.
|
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| screen resolution | tirupathi | Solaris | 2 | 06-21-2009 04:25 AM |
| Screen Saver Resolution | ambavaram | Solaris | 2 | 06-19-2008 12:48 PM |
| Changing my Screen Resolution (Not in X) | jjinno | UNIX for Dummies Questions & Answers | 3 | 07-18-2007 02:53 PM |
| Pre-Login Screen Resolution | Dredz | Solaris | 1 | 07-21-2005 08:14 AM |
| Changing Screen Resolution | Aco | Solaris | 1 | 07-18-2005 04:55 PM |