Added xdotool to dependencies because it is now required for the watchdog.

This commit is contained in:
Storm Dragon
2025-12-09 10:15:50 -05:00
parent 4eebbf2bed
commit 748fcde0b8
2 changed files with 11 additions and 11 deletions

View File

@@ -47,8 +47,8 @@ while true; do
ipcWorks=1
fi
# Also check if X focus is working
if DISPLAY=:0 timeout 1 xdotool getwindowfocus > /dev/null 2>&1; then
# Also check if X focus is working (use current DISPLAY, not hardcoded)
if timeout 1 xdotool getwindowfocus > /dev/null 2>&1; then
focusWorks=1
fi
@@ -102,34 +102,34 @@ while true; do
fi
# Check if this is a focus issue (Wine keyboard grab bug)
focusCheck=$(DISPLAY=:0 xdotool getwindowfocus 2>&1)
focusCheck=$(xdotool getwindowfocus 2>&1)
log_message "Focus check result: $focusCheck"
# Try to reset focus to i3
log_message "Attempting to reset X focus..."
DISPLAY=:0 xdotool key --clearmodifiers Super_L 2>/dev/null
xdotool key --clearmodifiers Super_L 2>/dev/null
sleep 0.5
# Try to focus on i3's root window
i3RootWindow=$(DISPLAY=:0 xdotool search --class "i3" | head -1)
i3RootWindow=$(xdotool search --class "i3" | head -1)
if [[ -n "$i3RootWindow" ]]; then
log_message "Focusing i3 root window: $i3RootWindow"
DISPLAY=:0 xdotool windowfocus "$i3RootWindow" 2>/dev/null
xdotool windowfocus "$i3RootWindow" 2>/dev/null
fi
# Try i3-msg to focus something
log_message "Using i3-msg to focus workspace..."
DISPLAY=:0 i3-msg workspace number 1 >/dev/null 2>&1
i3-msg workspace number 1 >/dev/null 2>&1
sleep 0.5
DISPLAY=:0 i3-msg focus output primary >/dev/null 2>&1
i3-msg focus output primary >/dev/null 2>&1
sleep 1
# Check if focus is actually fixed now
if DISPLAY=:0 timeout 1 xdotool getwindowfocus >/dev/null 2>&1; then
if timeout 1 xdotool getwindowfocus >/dev/null 2>&1; then
log_message "Focus recovery successful!"
else
log_message "Focus still broken - restarting i3..."
DISPLAY=:0 i3-msg -t run_command restart
i3-msg -t run_command restart
log_message "Restart command sent"
fi