Skip to content

Instantly share code, notes, and snippets.

@robotanarchy
Created January 3, 2016 23:24
Show Gist options
  • Save robotanarchy/33bf7f6fa7b5e9f88624 to your computer and use it in GitHub Desktop.
Save robotanarchy/33bf7f6fa7b5e9f88624 to your computer and use it in GitHub Desktop.
#!/bin/bash
# requirements: xwininfo, xprop
# usage:
# - (recommended) bind this script to a key in sway/orbment
# - run the script to get a bunch of debug information about the currently displayed x windows written to a logfile
# - pro-tip: run it before and after opening a window/dialog/tooltip, then do a diff of both logs to get just what you need
log=~/docs/logs/xwininfo/$(date +%s).log
xwininfo="$(xwininfo -tree -root)"
echo "#######################################################################################" >> "$log"
echo "# xwinfo -tree -root" >> "$log"
echo "#######################################################################################" >> "$log"
echo "$xwininfo" >> "$log"
echo "" >> "$log"
while read -r line; do
[[ "$line" != 0x* ]] && continue
echo "#######################################################################################" >> "$log"
echo "# $line" >> "$log"
echo "#######################################################################################" >> "$log"
id="$(echo $line | cut -d ' ' -f 1)"
xprop -id "$id" >> "$log"
echo "" >> "$log"
done <<< "$xwininfo"
echo "$(basename $0): debug info written to: $log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment