From: Colin Brough on
I'm now regularly working over two or three different machines, each
with different sized displays... I've got the twin-headed desktop,
with largish monitors, the laptop, and now the netbook with a 1024x600
display.

I have a few custom scripts for displaying things - particularly A4 or
A5 dvi files, or selecting landscape orientation for certain
postscript files. So instead of

bash -c "gv -nosafer -scale=-0 -center -geometry 1220x870+0+0
-media=a4 --orientation=seascape =$(/bin/ls --color=no -t *.ps | head -1) &"

I can type:

ggl

Obviously I want the scale and geometry stuff to be suitable for the
display I'm on, but would prefer not to have to maintain multiple sets
of aliases on the different machines.

Is there a way of a script discovering the resolution of the display
it is running on reasonably easily? If it helps, all the machines are
currently running Ubuntu 9.10 with a gnome desktop.

Cheers

Colin

--

----------------------------------------------------------------------
Colin Brough Colin.Brough(a)blueyonder.invalid
(Replace .invalid with .co.uk to reply)
From: Jim Price on
Colin Brough wrote:

> Is there a way of a script discovering the resolution of the display
> it is running on reasonably easily? If it helps, all the machines are
> currently running Ubuntu 9.10 with a gnome desktop.

This should tell you what screen parameters you have in use:
xrandr -q

--
JimP
From: Dave Gibson on
Colin Brough <Colin.Brough(a)blueyonder.invalid> wrote:

> Is there a way of a script discovering the resolution of the display
> it is running on reasonably easily? If it helps, all the machines are
> currently running Ubuntu 9.10 with a gnome desktop.

xwininfo and xprop. See the -display and -root arguments.
From: Gavin Kinsey on
Colin Brough wrote:

>
> Is there a way of a script discovering the resolution of the display
> it is running on reasonably easily? If it helps, all the machines are
> currently running Ubuntu 9.10 with a gnome desktop.

Run xrandr and parse the output a little to get the current mode.

From: Martin Gregorie on
On Fri, 08 Jan 2010 14:42:20 +0000, Colin Brough wrote:

> Obviously I want the scale and geometry stuff to be suitable for the
> display I'm on, but would prefer not to have to maintain multiple sets
> of aliases on the different machines.
>
Why not take a leaf out of the way you configure daemon services in
RedHat distros?

- Modify your script to get its arguments by reading in a config
file with a standard name. Use something like "source /etc/ggl.conf"

- The config file just contains a set of lines like:

ORIENTATION="seascape"
SCALE="0"
GEOMETRY="1220x870+0+0"


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |