summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Mubashshir <ahmubashshir@gmail.com>2023-01-04 23:10:41 +0600
committerLibravatar Mubashshir <ahmubashshir@gmail.com>2023-01-04 23:10:41 +0600
commitfb12eb325c5ec906ce0bba56c555df93da7d9c03 (patch)
treed97ce5fe4fbc33c66e33f22020fde83cf9483e58
parent04af14c312b14411368bb8540252c4aeb62efd34 (diff)
downloadpatches-fb12eb325c5ec906ce0bba56c555df93da7d9c03.tar.gz
patches-fb12eb325c5ec906ce0bba56c555df93da7d9c03.zip
simulate-refresh: Clean up code
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
-rwxr-xr-xbin/simulate-refresh19
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/simulate-refresh b/bin/simulate-refresh
index 064fade..7657457 100755
--- a/bin/simulate-refresh
+++ b/bin/simulate-refresh
@@ -1,17 +1,20 @@
#!/bin/sh
-AW=$( (
- xdotool getactivewindow
- printf :
- xdotool getactivewindow getwindowpid
-) | tr -d '[:space:]')
+AW=$(
+ xdotool getactivewindow
+ printf :
+ xdotool getactivewindow getwindowpid
+)
+AW=$(echo "$AW" | tr -d '[:space:]')
+
PROC=$(realpath "/proc/${AW#*:}/exe" | xargs basename)
-unset REFOCUS
+unset NOREFOCUS
+
if ! echo "$PROC" | grep -qlE '(thunar|xfdesktop)'; then
- REFOCUS=true
+ NOREFOCUS=false
xdotool search --onlyvisible --classname Xfdesktop windowfocus
fi
xdotool key F5
-"${REFOCUS:-false}" && xdotool windowfocus "${AW%:*}"
+"${NOREFOCUS:-true}" || xdotool windowfocus "${AW%:*}"