3

I am running OSMC Alpha 4 on my new Raspberry Pi 2. This comes with Kodi v14 (Helix), which auto-runs at boot.

I can run an X application (xclock for example) after first killing Kodi with pkill mediacenter && pkill kodi. The app displays fine.

However, If I don't first kill kodi, the app does not display on the screen (I am guessing Kodi overwrites the framebuffer or something?).

Is there a way to "minimize" kodi so I can run my X application without killing it first?

I run my X application via sudo xinit /home/osmc/.xinitrc.

#!/bin/bash
# ~/.xinitrc

xset -dpms
xset s off
xset s noblank

matchbox-window-manager &
xclock -g 50x50-0+0 -bw 0

kill $!

I've noticed OSMC runs kodi in a loop via the /usr/bin/mediacenter script, which is why I have to pkill mediacenter AND pkill kodi:

#!/bin/bash

# (c) 2014-2015 Sam Nazarko
# email@samnazarko.co.uk

fb_restore() {
    [ -e /var/run/fb_resolution ] && /bin/fbset $(cat /var/run/fb_resolution)
    /bin/fbset -depth 8 && /bin/fbset -depth 16
    echo 1 >/sys/class/vtconsole/vtcon1/bind
}

export TERM=linux
sudo chown osmc:osmc /sys/class/vtconsole/vtcon*/bind

if [ "$1" = "stop" ]; then
    fb_restore
    exit
fi

sudo chmod a+rw /dev/tty1
sudo /usr/bin/setterm --blank 0 </dev/tty1 >/dev/tty1

who | awk '{print $2}' | grep tty1 >/dev/null
if [ "$?" -ne 0 ]; then
    sudo systemctl stop getty@tty1
fi

if [ ! -e /var/run/fb_resolution ]; then
    /bin/fbset | grep geometry | awk '{print "-xres "$2" -yres "$3" -vxres "$4" -vyres "$5}' | sudo tee /var/run/fb_resolution >/dev/null
fi

while true; do
    sudo setcap cap_net_admin,cap_net_bind_service,cap_net_raw=e /usr/lib/kodi/kodi.bin
    /usr/lib/kodi/kodi.bin --standalone -fs --lircdev /var/run/lirc/lircd
    CODE="$?"

    fb_restore
    sudo chmod a+rw /dev/tty1
    sudo systemctl status getty@tty1 >/dev/null; GETTY=$?
    if [ "$GETTY" -ne 0 ]; then
        sudo chvt 1
        /usr/bin/setterm --cursor off >/dev/tty1
        /usr/bin/clear >/dev/tty1
        /usr/bin/ply-image "$CODE"
        read -n 1 -s -t 10 key </dev/tty1
    fi
    if [ "$key" = $'\e' -o "$GETTY" -eq 0 ]; then
        /bin/fbset -depth 8 && /bin/fbset -depth 16
        /usr/bin/setterm --cursor on >/dev/tty1
        sudo systemctl start getty@tty1
        count=30
        while [ $count -gt 0 ]; do
            who | awk '{print $2}' | grep tty1 >/dev/null
            if [ "$?" -eq 0 ]; then
                count=5
            else
                let count=count-5
            fi
            sleep 5
        done
        sudo systemctl stop getty@tty1
    fi
done
3

you can try:

xbmc-send -a "Minimize"

for other built-in functions: List of built-in functions

1
  • Unfortunately this didn't work - OSMC still controlled the screen, and I couldn't get my xclock instance to show up. But thanks for the suggestion - I didn't realise those commands existed! – Jess Telford Jun 15 '15 at 0:05
1

Sam Nazarko (creator of OSMC / Raspbmc) suggests:

Minimising Kodi is not easy. I think it captures the framebuffer on Raspberry Pi

I suggest stopping Kodi to save resources anyway. The proper way to do this:

sudo systemctl stop mediacenter

And to start again:

sudo systemctl start mediacenter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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