Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I use this script to launch XBMC:

#! /bin/bash
# Launch XBMC in windowed mode, then use wmctrl to remove the titlebar

DISPLAY=:0.0

# Start XBMC without blocking this script
xbmc &

# Wait for the XBMC window to appear
status=0
while [ $status -eq 0 ]
do
    sleep 1
 status=`wmctrl -x -l | grep "XBMC Media Center" | wc -l | awk '{print $1}'`
done

# Force XBMC window to fullscreen
#export SDL_VIDEO_FULLSCREEN_DISPLAY=1
wmctrl -x -t 0 -r XBMC Media Center.XBMC Media Center -b toggle,fullscreen

but the DISPLAY variable always changing... Why ? (I never change any configuration options) Sometimes it's 0.1, sometimes it's 0.0.
How should I modify the script to run whatever the value is, or what's a better solution ?

share|improve this question
    
Are you logging in as multiple users (switch user) ? –  bodhi.zazen Jan 10 '12 at 23:28
    
I don't understand your question :D how can you log in as multiple users ? If you mean that multiple user are logged in to the same machine, yes! –  Walkman Jan 11 '12 at 0:20

1 Answer 1

up vote 0 down vote accepted

Each user gets his or her own DISPLAY (Actually each X session), so they will change as users log in / log off and as you use the switch user feature.

share|improve this answer
    
ok, but how can I determine from the script which is the right DISPLAY right now ? –  Walkman Jan 11 '12 at 3:41
    
echo $DISPLAY or using $DISPLAY in a script will work for your current user. w | awk '/user_name/ {print $3}' will work for other users. –  bodhi.zazen Jan 11 '12 at 4:23
    
So I just remove the DISPLAY variable setting line. LOL. Thanks ! –  Walkman Jan 11 '12 at 5:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.