#!/bin/sh AW=$( ( xdotool getactivewindow printf : xdotool getactivewindow getwindowpid ) | tr -d '[:space:]') PROC=$(realpath "/proc/${AW#*:}/exe" | xargs basename) unset REFOCUS if ! echo "$PROC" | grep -qlE '(thunar|xfdesktop)'; then REFOCUS=true xdotool search --onlyvisible --classname Xfdesktop windowfocus fi xdotool key F5 "${REFOCUS:-false}" && xdotool windowfocus "${AW%:*}"