You are not logged in.

#1 2008-12-23 10:39:52

synthead
Member
Registered: 2006-05-09
Posts: 1,337

[solved!] Running a command to detect the current resolution of X?

I want to write a script that detects the resolution I'm running and echo it to a configuration file.  I've heard of xrandr, but when I run it, I get ...

[max@pwn rigsofrods]$ xrandr
Xlib:  extension "RANDR" missing on display ":0.0".
RandR extension missing

This script will be a part of a PKGBUILD, so I'm hoping there's something really simple and seamless that I could use for just about anyone's computer regardless of configuration.

Last edited by synthead (2008-12-24 00:33:27)

Offline

#2 2008-12-23 10:52:39

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: [solved!] Running a command to detect the current resolution of X?

try to export DISPLAY before running xrandr
export DISPLAY=:0.0


Give what you have. To someone, it may be better than you dare to think.

Offline

#3 2008-12-23 11:18:47

RodrickCZ
Member
From: Czech Republic
Registered: 2007-12-11
Posts: 9

Re: [solved!] Running a command to detect the current resolution of X?

What about      xdpyinfo | grep -i dimensions      ?


Excuse my lame english.

Offline

#4 2008-12-23 19:17:50

mutlu_inek
Member
From: all over the place
Registered: 2006-11-18
Posts: 683

Re: [solved!] Running a command to detect the current resolution of X?

Do you use xinerama? It currently unloads randr since the concepts underlying both utilities are incompatible.

Offline

#5 2008-12-23 19:41:10

Onyros
Member
From: Lisbon, Portugal
Registered: 2007-10-11
Posts: 307

Re: [solved!] Running a command to detect the current resolution of X?

RodrickCZ wrote:

What about      xdpyinfo | grep -i dimensions      ?

For it to output just the dimensions...

xdpyinfo |  awk '/dimensions/{print$2}'

will do it.

Offline

#6 2008-12-24 00:30:48

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved!] Running a command to detect the current resolution of X?

Onyros wrote:
RodrickCZ wrote:

What about      xdpyinfo | grep -i dimensions      ?

For it to output just the dimensions...

xdpyinfo |  awk '/dimensions/{print$2}'

will do it.

That is PERFECT! Thanks! big_smile

Offline

#7 2008-12-24 17:22:16

Onyros
Member
From: Lisbon, Portugal
Registered: 2007-10-11
Posts: 307

Re: [solved!] Running a command to detect the current resolution of X?

synthead wrote:
Onyros wrote:
RodrickCZ wrote:

What about      xdpyinfo | grep -i dimensions      ?

For it to output just the dimensions...

xdpyinfo |  awk '/dimensions/{print$2}'

will do it.

That is PERFECT! Thanks! big_smile

Ah, you're welcome! You've got me curious about that PKGBUILD, though... smile

Offline

#8 2008-12-27 10:20:07

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved!] Running a command to detect the current resolution of X?

Haha.  I made a better solution with the PKGBUILD, actually smile  Rigs of Rods isn't the "smartest" linux game so lots of configs are in the program directory.  Just like any other big game, I put it in /opt, so there were a lot of permission issues and complications when regular users tried to configure the game.  What I ended up doing is replacing the blank config it comes with with a very basic 800x600 windowed configuration, and if a user runs RoR, a little script makes a hidden folder and copies it to it.  From there, that section of the configuration utility edits the ~/.rigsofrods configuration smile  And as you would expect, its in plaintext, so you can edit it by hand too.

But not ignoring all the other configs that have to be in /opt/rigsofrods, I made a group called "ror" that allows rw access to config files and allows you to fully configure the game.

Offline

#9 2008-12-27 10:21:47

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved!] Running a command to detect the current resolution of X?

http://aur.archlinux.org/packages.php?ID=22354 wink

Oh, and http://rigsofrods.com/

PS - In typing this, I realized something that I sould add to my scripts to prevent bugs, so I'll have a new PKGBUILD up soon if you're curious enough to build it ...

Offline

#10 2008-12-27 11:24:30

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved!] Running a command to detect the current resolution of X?

Done, I'm at release 5 now.

Offline

#11 2008-12-27 13:51:31

mutlu_inek
Member
From: all over the place
Registered: 2006-11-18
Posts: 683

Re: [solved!] Running a command to detect the current resolution of X?

What about a few screenshots or some more info?

Offline

Board footer

Powered by FluxBB