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