i3-focusedwindow_backup 362 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. # Author: Kn
  3. while :
  4. do
  5. ID=$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')
  6. if [[ $1 ]]
  7. then
  8. TITLE=$(xprop -id $ID -len $1 | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2)
  9. echo "$TITLE"
  10. else
  11. TITLE=$(xprop -id $ID | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2)
  12. echo "$TITLE"
  13. fi
  14. done