#!/bin/sh has_ewmh_wm() { local name local id local child_id echo has_ewmh_wm # If property does not exist, "id" will contain "no such atom on any window" read name id <<< $(xprop -root 32x ' $0\n' _NET_SUPPORTING_WM_CHECK) read name child_id <<< $(xprop -id "${id}" 32x ' $0\n' _NET_SUPPORTING_WM_CHECK 2>/dev/null) if [ "${id}" != "${child_id}" ]; then echo wrong id: $id vs $child_id return 1 fi return 0 } wait_for_wm() { for i in `seq 30`; do if has_ewmh_wm; then return 0 fi sleep 1 done return 1 } killall xclock openbox lt-openbox sleep 1 killall -9 xclock openbox lt-openbox sleep 1 # Uncomment to start app before OB #xclock & ~/tmp/openbox/openbox/openbox & echo Waiting for _NET_SUPPORTING_WM_CHECK wait_for_wm echo Valid _NET_SUPPORTING_WM_CHECK found # Uncomment to start app when _NET_SUPPORTING_WM_CHECK is found xclock