jlesage / docker-baseimage-gui

A minimal docker baseimage to ease creation of X graphical application containers
MIT License
1.2k stars 179 forks source link

Prevent minimize for very customized non-standard UIs #21

Closed shiomax closed 5 years ago

shiomax commented 5 years ago

I´m currently trying to base a JRiver Media Center 25 container off your image. It´s already kind of working, but when you click minimize you have no way to get it back, other than restarting the container.

If you´re interested I have made the repo public on my gitlab right now https://gitlab.shio.at/max/jrivermc25-docker

Would be glad for any suggestions on how to achieve this, or wether or not you had to deal with this before. It works fine with guis that use standard window decorations. They go away. But for this one it neigher will go fullscreen on start, nor will it remove the mimize actions.

I don´t really expect any help necessarily. But if you already know, I´d appreaciate it nevetheless. Otherwise, I´ll keep digging this weekend (or after) and report back if I happened to solve it eventually.

shiomax commented 5 years ago

I managed to resolve this now. Maybe not in the best way, but it does bring back the Window now as soon as it's minimized.

I did this by creating a service within /etc/services.d

The run file being

#!/usr/bin/with-contenv sh
if ! screen -list | grep -q "xpropspy"; then
    screen -S xpropspy -dm bash -c "xprop -root -spy | /etc/services.d/xpropspy/xpropspy.sh"
fi

/etc/services.d/xpropspy/xpropspy.sh

while read line; do
    search=$(echo "$line" | grep "_NET_ACTIVE_WINDOW(WINDOW): window id # ")

    if [ ! -z "$search" ]; then
        echo "Active Window changed: $search"
        hex=$(echo "$line" | cut -c41-)

        if [ $hex == "0x0" ]; then
            bash /setactive.sh
        fi
    fi
done

/setactive.sh

# get id of the focused window
active_win_id=$(obxprop --root | grep '^_NET_ACTIVE_W' | grep -o '[0-9]\+')
echo "Currently active Window is $active_win_id"

if [[ $active_win_id -eq 0 ]]; then
    # get id of first client in list
    switch_to=$(obxprop --root | grep '^_NET_CLIENT_LIST(WINDOW)' | grep -o '[0-9]\+' | head -n 1)
    echo "Changing window to $switch_to"
    wmctrl -i -a $switch_to
fi
jlesage commented 5 years ago

Sorry to not have been able to answer sooner.

If you don't have access to the code source, then I guess that the way you did it is a good alternative!