setting background image by shell command?

houghi houghi at houghi.org
Wed May 1 12:32:05 CEST 2013


On Wed, May 01, 2013 at 11:13:54AM +0200, Suvayu Ali wrote:
> 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.

It only shows the screen it runs from, so not usefull for me. :-(

Searching shows basically information on how to do things when you already
know what you need. That is if searching for DISPLAY. Looking for
'screens' comes up with basically the command screen

So what  find is
a) Do something with DIPLAY=:0.0
b) What is the output of $DISPLAY so you can use it in a)

However I found a solution. I first looked in the some manpages, including 
xrandr and no solution. I then found the program xdpyinfo and no solution,
but the manpage also talked about xvinfo. I first tried the other
programs, but they gave nothing. However when I ran xvinfo I saw a LOT of
information, including (scroling up from the end) 'screen #3' and that
looked very familiar. :-D

So all I have to do is the following:
houghi at penne : xvinfo|grep ^screen
screen #0
screen #1
screen #2
screen #3

Then just get things from the last line after the # and I am good. With
that information it should be trivial to figure out all the rest I need to
know. Sample at the end.

If people out there are wallpaper changer makers, please keep in mind that
there are weird people who have more then one screen/monitor/display.
Those who do are not all using Xinerama or twinview.

Actually the main reason I use XFCE is because I am not forced to use
Xinerama like GNOME and KDE force me to use. (Yeah, I could try to figure
out how to, but why would I if XFCE is doing a great job?)

#!/bin/bash
# Example of usage
# Show the size of each screen
for I in $(seq 0 $(xvinfo|grep ^screen|sort|tail -n 1|awk -F# '{print $NF}'))
do
	xrandr -display :0.${I}|grep '*'|awk '{print $1}'
done

houghi
-- 
If you owe the bank $100 that's your problem. 
If you owe the bank $100 million, that's the bank's problem.
If you owe the bank $700 billion, it becomes your problem again.


More information about the Xfce mailing list