setting background image by shell command?

Suvayu Ali fatkasuvayu+linux at gmail.com
Wed May 1 11:13:54 CEST 2013


On Wed, May 01, 2013 at 04:03:29AM +0200, houghi wrote:
> 
> Question: I know how many screens I have, but how could I find this out
> with a bash script? I do not mean running `echo $DISPLAY` on each and then
> looking what the highest number is. I mean that I should get an output of
> 4 (or 3 if it starts counting from 0) with my 4 screens and if I have 2 on
> another system, I get the answer 2 with the same script/command.

How about asking xrandr?

  $ xrandr -q
  Screen 0: minimum 320 x 200, current 2960 x 1050, maximum 8192 x 8192
  LVDS1 connected primary 1280x800+1680+0 (normal left inverted right x axis y axis) 261mm x 163mm
     1280x800       60.0*+   50.1  
     1024x768       60.0  
     800x600        60.3     56.2  
     640x480        59.9  
  VGA1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 474mm x 296mm
     1680x1050      59.9*+   60.0  
     1280x1024      75.0     60.0  
     1440x900       75.0     59.9  
     1280x960       60.0  
     1152x864       75.0  
     1024x768       75.1     60.0  
     832x624        74.6  
     800x600        75.0     60.3     56.2  
     640x480        75.0     60.0  
     720x400        70.1  
  HDMI1 disconnected (normal left inverted right x axis y axis)
  DP1 disconnected (normal left inverted right x axis y axis)

The first line tells you the screen number.  Now I'm not sure if it
tells you only about the X screen xrandr was called from or all X
screens running on the system.  Not sure what would be the best way to
find out the number of monitors for each screen though.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.


More information about the Xfce mailing list