Skip to content

Instantly share code, notes, and snippets.

@v6ak
Created May 22, 2015 12:38
Show Gist options
  • Save v6ak/9a38c5d643d17a53e799 to your computer and use it in GitHub Desktop.
Save v6ak/9a38c5d643d17a53e799 to your computer and use it in GitHub Desktop.
#!/bin/bash
old=""
while true; do
new="$(xdotool getwindowfocus)"
if [ "$old" != "$new" ]; then
echo a
# Tried both windowfocus and windowactivate
xdotool \
search --onlyvisible --class '^Plasma$' \
windowfocus --sync \
windowfocus --sync "$new" \
getwindowname "$new"
echo c
# "$(xdotool search --onlyvisible --class '^Plasma$' | head -n 1)"
fi
old="$new"
sleep 0.1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment