Quantcast
Channel: PuppyPowered » script
Viewing all articles
Browse latest Browse all 2

XBMC Launch Script for Ubuntu 11.04

$
0
0

Being a happy Ubuntu user for a while, I installed XBMC on my HTPC. As this machine is also used as a desktop (it’s in the living room) I wanted a script to launch Ubuntu and place it on the TV that is connected trough HDMI. After trying a bunch of scripts I found on the internet none of them really worked the way I wanted. For starters, Gnome only gives me one desktop to play around with. This script does the following:

  • Disable the power manager
  • Activate HDMI1
  • Start XMBC, move it to the second scren and maximize it
  • Undo the above once XBMC is closed

Off course you will need to change a few parameters to make it work for your case. Your TV might not be connected to HDMI1 and may have a different size for example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/bash
if $(xrandr --prop |grep -q "HDMI1 connected")
then
    echo "Disable Power Manager"
    gconftool-2 --set --type integer "/apps/gnome-power-manager/timeout/sleep_computer_ac" 0

    echo "Activate HDMI1"
    xrandr --output HDMI1 --left-of HDMI2 --mode 1920x1080
    xrandr --output HDMI2 --auto --primary

    echo "Start XBMC in background"
    killall -s9 -q xbmc.bin
    xbmc &

    echo "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

    echo "Move XBMC to secondary screen"
    wmctrl -x -r XBMC Media Center.XBMC Media Center -e 0,0,0,800,600

    sleep 1
   
    echo "Force XBMC window to fullscreen"
    wmctrl -x -r XBMC Media Center.XBMC Media Center -b toggle,fullscreen

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

    echo "Disable HDMI1"
    xrandr --output HDMI1 --off

    echo "Wait 2 seconds for xrandr to complete"
    sleep 2

    echo "Enable Power Manager (Sleep / 30 Minutes)"
    gconftool-2 --set --type integer "/apps/gnome-power-manager/timeout/sleep_computer_ac" 1800
else
    echo -e "HDMI1 is not connected"
fi

There you go. If you have any suggestions or need help getting this to work on your end feel free to leave a comment!


Viewing all articles
Browse latest Browse all 2

Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Trending Articles


Gwapo Quotes : Babaero Quotes


Dino Rey para colorear


Girasoles para colorear


Dibujos de animales para imprimir


Renos para colorear


Dromedario para colorear


Love Quotes Tagalog


Mga Patama Quotes at Pamatay Banat Quotes


RE: Mutton Pies (mely)


El Vibora (1971) by Francisco V. Coching and Federico C. Javinal





Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC