[Docker] Openbox Window vanishes

Summary

I’m currently trying to build a docker image (or already did) for my music player to run on my NAS. More information can be found on my gitlab readme. Since I’ve already typed out a fair description there I won’t do that again.

Anyways, the big problem now is that I have one docker container where the Window has vanished. The application surely is running (since I can remote play music from it, access it’s api, web ui and so forth), but the desktop application has vanished and it’s kinda important for some things that just aren’t possible any other way.

Though, I’ve got a ci pipeline setup for this, witch I find really cool. Not that it’s gonna help me much if the container does not do it’s job.


What I think might be useful Information

The output of obxprop --root is

Broken Container

_NET_ACTIVE_WINDOW(WINDOW) = 0
root@centx:/tmp# oxprop --root 
bash: oxprop: command not found
root@centx:/tmp# obxprop --root
_NET_ACTIVE_WINDOW(WINDOW) = 0
_NET_CLIENT_LIST(WINDOW) = 16777275
_NET_SHOWING_DESKTOP(CARDINAL) = 0
_NET_CURRENT_DESKTOP(CARDINAL) = 0
_NET_DESKTOP_NAMES(UTF8_STRING) = "desktop 1"
_NET_WORKAREA(CARDINAL) = 0, 0, 1280, 768
_NET_DESKTOP_VIEWPORT(CARDINAL) = 0, 0
_NET_NUMBER_OF_DESKTOPS(CARDINAL) = 1
_NET_DESKTOP_GEOMETRY(CARDINAL) = 1280, 768
_NET_CLIENT_LIST_STACKING(WINDOW) = 16777275
_OB_THEME(UTF8_STRING) = "Clearlooks"
_OB_VERSION(UTF8_STRING) = "3.6.1"
_NET_SUPPORTED(ATOM) = _NET_SUPPORTING_WM_CHECK, _NET_WM_FULL_PLACEMENT, _NET_CURRENT_DESKTOP, _NET_NUMBER_OF_DESKTOPS, _NET_DESKTOP_GEOMETRY, _NET_DESKTOP_VIEWPORT, _NET_ACTIVE_WINDOW, _NET_WORKAREA, _NET_CLIENT_LIST, _NET_CLIENT_LIST_STACKING, _NET_DESKTOP_NAMES, _NET_CLOSE_WINDOW, _NET_DESKTOP_LAYOUT, _NET_SHOWING_DESKTOP, _NET_WM_NAME, _NET_WM_VISIBLE_NAME, _NET_WM_ICON_NAME, _NET_WM_VISIBLE_ICON_NAME, _NET_WM_DESKTOP, _NET_WM_STRUT, _NET_WM_STRUT_PARTIAL, _NET_WM_ICON, _NET_WM_ICON_GEOMETRY, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_TOOLBAR, _NET_WM_WINDOW_TYPE_MENU, _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_SPLASH, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_NORMAL, _NET_WM_ALLOWED_ACTIONS, _NET_WM_WINDOW_OPACITY, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_STATE, _NET_WM_STATE_MODAL, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_SHADED, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_SKIP_PAGER, _NET_WM_STATE_HIDDEN, _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_ABOVE, _NET_WM_STATE_BELOW, _NET_WM_STATE_DEMANDS_ATTENTION, _NET_MOVERESIZE_WINDOW, _NET_WM_MOVERESIZE, _NET_WM_USER_TIME, _NET_FRAME_EXTENTS, _NET_REQUEST_FRAME_EXTENTS, _NET_RESTACK_WINDOW, _NET_STARTUP_ID, _NET_WM_SYNC_REQUEST, _NET_WM_SYNC_REQUEST_COUNTER, _NET_WM_PID, _NET_WM_PING, _KDE_WM_CHANGE_STATE, _KDE_NET_WM_FRAME_STRUT, _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _OB_WM_ACTION_UNDECORATE, _OB_WM_STATE_UNDECORATED, _OPENBOX_PID, _OB_THEME, _OB_CONFIG_FILE, _OB_CONTROL, _OB_VERSION, _OB_APP_ROLE, _OB_APP_TITLE, _OB_APP_NAME, _OB_APP_CLASS, _OB_APP_GROUP_NAME, _OB_APP_GROUP_CLASS, _OB_APP_TYPE
_NET_SUPPORTING_WM_CHECK(WINDOW) = 4194827
_OPENBOX_PID(CARDINAL) = 782
X11VNC_TICKER(STRING) = "742/00000019/890511522/1559215474.320411"
_XKB_RULES_NAMES(STRING) = "evdev", "pc105", "us", "", ""
Working Container

_NET_ACTIVE_WINDOW(WINDOW) = 16777446
root@02ce6250821a:/tmp# obxprop --root
CUT_BUFFER0(STRING) = "KZHD4-UZD01-A3940-4JPJ7-X38A2-H1IQ8"
_NET_ACTIVE_WINDOW(WINDOW) = 16777446
X11VNC_TICKER(STRING) = "791/00000981/882916809/1559223091.470970"
_NET_CLIENT_LIST(WINDOW) = 16777446
_NET_SHOWING_DESKTOP(CARDINAL) = 0
_NET_CURRENT_DESKTOP(CARDINAL) = 0
_NET_DESKTOP_NAMES(UTF8_STRING) = "desktop 1"
_NET_WORKAREA(CARDINAL) = 0, 0, 1280, 768
_NET_DESKTOP_VIEWPORT(CARDINAL) = 0, 0
_NET_NUMBER_OF_DESKTOPS(CARDINAL) = 1
_NET_DESKTOP_GEOMETRY(CARDINAL) = 1280, 768
_NET_CLIENT_LIST_STACKING(WINDOW) = 16777446
_OB_THEME(UTF8_STRING) = "Clearlooks"
_OB_VERSION(UTF8_STRING) = "3.6.1"
_NET_SUPPORTED(ATOM) = _NET_SUPPORTING_WM_CHECK, _NET_WM_FULL_PLACEMENT, _NET_CURRENT_DESKTOP, _NET_NUMBER_OF_DESKTOPS, _NET_DESKTOP_GEOMETRY, _NET_DESKTOP_VIEWPORT, _NET_ACTIVE_WINDOW, _NET_WORKAREA, _NET_CLIENT_LIST, _NET_CLIENT_LIST_STACKING, _NET_DESKTOP_NAMES, _NET_CLOSE_WINDOW, _NET_DESKTOP_LAYOUT, _NET_SHOWING_DESKTOP, _NET_WM_NAME, _NET_WM_VISIBLE_NAME, _NET_WM_ICON_NAME, _NET_WM_VISIBLE_ICON_NAME, _NET_WM_DESKTOP, _NET_WM_STRUT, _NET_WM_STRUT_PARTIAL, _NET_WM_ICON, _NET_WM_ICON_GEOMETRY, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_TOOLBAR, _NET_WM_WINDOW_TYPE_MENU, _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_SPLASH, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_NORMAL, _NET_WM_ALLOWED_ACTIONS, _NET_WM_WINDOW_OPACITY, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_STATE, _NET_WM_STATE_MODAL, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_SHADED, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_SKIP_PAGER, _NET_WM_STATE_HIDDEN, _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_ABOVE, _NET_WM_STATE_BELOW, _NET_WM_STATE_DEMANDS_ATTENTION, _NET_MOVERESIZE_WINDOW, _NET_WM_MOVERESIZE, _NET_WM_USER_TIME, _NET_FRAME_EXTENTS, _NET_REQUEST_FRAME_EXTENTS, _NET_RESTACK_WINDOW, _NET_STARTUP_ID, _NET_WM_SYNC_REQUEST, _NET_WM_SYNC_REQUEST_COUNTER, _NET_WM_PID, _NET_WM_PING, _KDE_WM_CHANGE_STATE, _KDE_NET_WM_FRAME_STRUT, _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _OB_WM_ACTION_UNDECORATE, _OB_WM_STATE_UNDECORATED, _OPENBOX_PID, _OB_THEME, _OB_CONFIG_FILE, _OB_CONTROL, _OB_VERSION, _OB_APP_ROLE, _OB_APP_TITLE, _OB_APP_NAME, _OB_APP_CLASS, _OB_APP_GROUP_NAME, _OB_APP_GROUP_CLASS, _OB_APP_TYPE
_NET_SUPPORTING_WM_CHECK(WINDOW) = 2097675
_OPENBOX_PID(CARDINAL) = 768
_XKB_RULES_NAMES(STRING) = "evdev", "pc105", "us", "", ""

Note how in the working container the active window is 0, while in the other one it’s set. Restarting the container does not bring it back either. I’m guessing I somehow have to pick the one and only active Window I can find on start within _NET_CLIENT_LIST_STACKING and set that as the active window. Though, I have absolutely no idea how to do this.


Another minor problem

A bit of a less suveir problem. The minimize button isn’t gone (as it should be), because JRiver does not exactly use Window decorations, but draws it’s own buttons. So you can minimize the Window and you won’t have any way (other than restart the container) to bring it back. Yes, that works usually. But for some reason on this one container that broke, it does not anymore.

Just added a bit of a workaround script that seems to bring the window back when there is none

# 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 ids of active clients
    switch_to=$(obxprop --root | grep '^_NET_CLIENT_LIST(WINDOW)' | grep -o '[0-9]\+' | head -n 1)
    echo "Currently active Clients is $switch_to"
    wmctrl -i -a $switch_to
fi

Now, just gotta figure out when to actually run this…

Also, when you start the container for the first time it usually takes forever for the window to appear. But when I run that script it appears much faster than it otherwise would. So that’s neat. Might do more than just fix the Window not being there at all.