summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7ec9bb1)
Always print the ID, and optionally the window name if there is one.
Also if the window has no name try to get the parent id and name.
get_owner() {
echo -n "$1"
get_owner() {
echo -n "$1"
- OWNER=$(./xowner $1)
- if [ $OWNER != "0x0" ];
+ OWNER_ID=$(./xowner $1)
+ if [ $OWNER_ID != "0x0" ];
- xwininfo -id $OWNER > /dev/null 2>&1;
+ OWNER="$OWNER_ID"
+ xwininfo -id $OWNER_ID > /dev/null 2>&1;
- OWNER_NAME=$(xprop -id $OWNER | grep "^WM_NAME" | cut -d ' ' -f 3-)
- if [ -z "$OWNER_NAME" ];
+ OWNER_NAME=$(xprop -id $OWNER_ID | grep "^WM_NAME" | cut -d ' ' -f 3-)
+ if [ -n "$OWNER_NAME" ];
+ OWNER="$OWNER $OWNER_NAME"
+ else
+ PARENT_ID=$(xwininfo -children -id $OWNER_ID | sed -n -e '/Parent window id:/s/.*window id: \([^ ]*\) .*$/\1/p')
+ if [ -n "$PARENT_ID" ];
+ then
+ OWNER="$OWNER children of $PARENT_ID"
+
+ PARENT_NAME=$(xprop -id $PARENT_ID | grep "^WM_NAME" | cut -d ' ' -f 3-)
+ if [ -n "$PARENT_NAME" ];
+ then
+ OWNER="$OWNER $PARENT_NAME"
+ fi
+ fi
- echo -n " owned by $OWNER_NAME"
+ echo -n " owned by $OWNER"