LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-03-2008, 11:47 AM   #1
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
Find X resolution from a script when X isn't running.


Does anyone know how to find the resolution that X runs at, when X may or may not be running and if it is, you don't have permission to access the display? (So xdpyinfo is no use.)

I want to resize a bunch of images for use as the background to a login screen. The script would be called either as a cronjob or as the post install script in an rpm. The images will be deployed to multiple machines with different resolution monitors attached. Resizing images from a script using imagemagick is trival, but my problem is how to know what dimensions to resize the image to. The only file I can find that contains the resolution is xorg.conf and I can't work out how to extract the default resolution from that with 100% reliability.
 
Old 11-03-2008, 12:06 PM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
If you have permission, you could read the xorg.conf file and try to discern from that. Or you might read the log from the last start of X and that would tell you what resolution X used the last time it started.

Beyond that, I wouldn't think you could tell.
 
Old 11-04-2008, 01:53 PM   #3
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Original Poster
Rep: Reputation: 198Reputation: 198
Like I said, can't figure out a reliable way to get it from xorg.conf. Your log idea looks like it'll work though, cheers.

On SLED 10, which is what I'll be using, /var/log/Xorg.0.log can be grep-ed for 'Virtual size' to find a line which contains the relevant resolution. I've checked it on machines with three different resolution monitors so it seems to be reliable method of determining the resolution. Only minor niggle is that the resolution format is slightly different and the line contains different text depending on whether the video drivers is Intel or Nvidia. Should be easy enough to deal with though.

On my Kubuntu machine it seems the phrase to look for in Xorg.0.log is 'Virtual screen size'.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
run a shell script on remote client from a server to find all its running process robin singh Linux - Newbie 7 10-03-2008 11:32 AM
i get an error message running php script inside a cgi script. repolona Linux - Software 0 02-22-2007 09:10 PM
Checking what resolution X is running at pwaring Linux - Software 2 06-05-2004 02:36 PM
how to find the pid of a perl script from shell script toovato Linux - General 1 12-19-2003 06:25 PM
changing resolution while X is running rlpt Linux - General 1 02-27-2002 01:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration