You are not logged in.
I've grown quite attached to a little script for my laptop that lets me randomly switch the background with nitrogen:
#! /bin/bash
WALLPAPERS="/home/elias/Pics/BackgroundShow"
ALIST=( `ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
nitrogen --set-zoom-fill --save $WALLPAPERS/${ALIST[$number]} <---------- Just need to specify the screen here...
I've had no luck finding how to change just screen 1 or 2 without the GUI. If there's a way, I would just have a separate hotkey for both. man nitrogen and nitrogen --help say nothing about setting for a particular screen.
Any help would be appreciated
Sometimes I just want people to expect me to do what I would do instead of what most people would do.
Offline
What about
DISPLAY=":0.1"Offline
What about
DISPLAY=":0.1"
There's no separate DISPLAYs anymore in the xrandr world.
@pw_f100_220: May I suggest using imlibsetroot instead of nitrogen? It can change just a single screen using "-x 0" and "-x 1". The rest of it's options shouldn't be hard to figure out, just look at the --help output.
Offline
I'm playing with imlibsetroot, but it doesn't appear to have the same "zoom-fill" function, and if you set one at a time, it clears the other screen. So you can shuffle both with this:
#! /bin/bash
WALLPAPERS="/home/elias/Pics/BackShow"
ALIST=( `ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
let "number2 = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number2"
let "number2 = $LASTNUM % $RANGE"
echo $number2 > $WALLPAPERS/.last
imlibsetroot -x 0 -s $WALLPAPERS/${ALIST[$number]} -x 1 -s $WALLPAPERS/${ALIST[$number2]}the option -s scales the image until it fills either the x or y dimension leaving black space. Of course I could crop or limit myself to images with the right aspect ratio, but that's not a solution. The options seem fairly extensive, but I don't see a way to emulate "zoom-fill":
usage: imlibsetroot [globalopts] {[screenopts] [imageopts] <filename>}+
global options
--help print usage information
--version print version information
--composite combine the images with the current root window
--display DDD connect to X display DDD
--store store the new root image to ~/.background.png
--store FILE store the new root image to FILE
--storeslices store the root image of each xinerama display
as a seperate file. (Implies --store .)
screen options
-x s operate on the single virtual xinerama screen
(default)
-x e operate on all xinerama screens independently
-x N operate on xinerama screen N
image options
-s scale pixmap to the current screen's size
preserving the pixmap's original aspect ratio
-s a scale pixmap to the current screen's size
preserving the pixmap's original aspect ratio
-s f scale pixmap to the current screen's size
without regard to the pixmap's original
aspect ratio
-s N scale pixmap by N percent
-s X,Y set the pixmap's width to X pixels and height
to Y pixels
-m {xy} mirror across the X/Y axis
-r {r|rr|l|ll} rotate right/left once or twice
-f {xy} flip the pixmap across the X/Y axis
-p c center pixmap on both axes
-p cx center pixmap on x
-p cy center pixmap on y
-p X,Y place pixmap at position X, Y on the current
screen (current screen based coordinates)
-t (integer tiling if combined with center
--bg COLOR set background color (the area not covered by the
image) to COLOR (COLOR may be a mnemonic, or a
RRR,GGG,BBB triple) (may be used without an image)
--bgcolor COLOR same as --bgSometimes I just want people to expect me to do what I would do instead of what most people would do.
Offline
So just for fun, I tried --display as an option (which is not listed anywhere) with various titles: xin_0, 0, 0.0, 1, 0.1, etc. And it returns:
(nitrogen:8108): Gtk-WARNING **: cannot open display: 0.0Is this nitrogen telling me it's the wrong display or GTK telling me I'm trying to run nitrogen on the wrong display? In other words, if I could find out what nitrogen wants to call the displays, would --display work? If you try other forms (--DISPLAY...) it returns "Unexpected argument DISPLAY" which suggests that --display is real...or am I just reaching through the dark?
I looked at nitrogens bg-saved.cfg file, and they were calling the displays [xin_0] and [xin_1].
Sometimes I just want people to expect me to do what I would do instead of what most people would do.
Offline
So I know this is old and I'm not sure if you still care, but I managed to make a bit of a workaround. I modified the script you listed to change the bg-saved.cfg file and give nitrogen the restore command.
#! /bin/bash
#using the path WALLPAPERS will select a new random wallpaper
WALLPAPERS="/file/path/to/wallpapers"
ALIST=( `ls -w1 $WALLPAPERS` )
RANGE=${#ALIST[@]}
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
sed -i '7 c\file='$WALLPAPERS/${ALIST[$number]}'' /home/user/.config/nitrogen/bg-saved.cfg
let "number = $RANDOM"
let LASTNUM="`cat $WALLPAPERS/.last` + $number"
let "number = $LASTNUM % $RANGE"
echo $number > $WALLPAPERS/.last
sed -i '12 c\file='$WALLPAPERS/${ALIST[$number]}'' /home/user/.config/nitrogen/bg-saved.cfg
nitrogen --restore
exitI'm definitely a Linux newbie, so there me a more elegant way to achieve this. Using this, you should be able write a cron job or have conky execute it to change wallpapers on a schedule.
Offline
I've adapted your script to :
#!/bin/bash
#using the path WALLPAPERS will select a new random wallpaper
WALLPAPERS=~/data/images/wallpapers
RANGE=$(ls $WALLPAPERS | wc -l)
for i in 2 7 12 ; do
let "number = $RANDOM % $RANGE"
IMAGE=$(ls $WALLPAPERS | head -$number | tail -1)
sed -i $i' c\file='"$WALLPAPERS/$IMAGE"'' ~/.config/nitrogen/bg-saved.cfg
done
nitrogen --restoreOffline