Files
_dotfiles/.config/i3blocks/i3-focusedwindow/i3-focusedwindow
2024-06-12 13:49:42 +02:00

16 lines
362 B
Bash
Executable File

#!/usr/bin/env bash
# Author: Kn
while :
do
ID=$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')
if [[ $1 ]]
then
TITLE=$(xprop -id $ID -len $1 | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2)
echo "$TITLE"
else
TITLE=$(xprop -id $ID | awk '/_NET_WM_NAME/{$1=$2="";print}' | cut -d'"' -f2)
echo "$TITLE"
fi
done