Added xdotool to dependencies because it is now required for the watchdog.
This commit is contained in:
2
i38.sh
2
i38.sh
@@ -21,7 +21,7 @@ configFile="${PWD}/I38_preferences.conf"
|
|||||||
export DIALOGOPTS='--no-lines --visit-items'
|
export DIALOGOPTS='--no-lines --visit-items'
|
||||||
|
|
||||||
# Check to make sure minimum requirements are installed.
|
# Check to make sure minimum requirements are installed.
|
||||||
for i in dialog jq yad ; do
|
for i in dialog jq yad xdotool ; do
|
||||||
if ! command -v "$i" &> /dev/null ; then
|
if ! command -v "$i" &> /dev/null ; then
|
||||||
missing+=("$i")
|
missing+=("$i")
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ while true; do
|
|||||||
ipcWorks=1
|
ipcWorks=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Also check if X focus is working
|
# Also check if X focus is working (use current DISPLAY, not hardcoded)
|
||||||
if DISPLAY=:0 timeout 1 xdotool getwindowfocus > /dev/null 2>&1; then
|
if timeout 1 xdotool getwindowfocus > /dev/null 2>&1; then
|
||||||
focusWorks=1
|
focusWorks=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -102,34 +102,34 @@ while true; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if this is a focus issue (Wine keyboard grab bug)
|
# 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"
|
log_message "Focus check result: $focusCheck"
|
||||||
|
|
||||||
# Try to reset focus to i3
|
# Try to reset focus to i3
|
||||||
log_message "Attempting to reset X focus..."
|
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
|
sleep 0.5
|
||||||
|
|
||||||
# Try to focus on i3's root window
|
# 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
|
if [[ -n "$i3RootWindow" ]]; then
|
||||||
log_message "Focusing i3 root window: $i3RootWindow"
|
log_message "Focusing i3 root window: $i3RootWindow"
|
||||||
DISPLAY=:0 xdotool windowfocus "$i3RootWindow" 2>/dev/null
|
xdotool windowfocus "$i3RootWindow" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try i3-msg to focus something
|
# Try i3-msg to focus something
|
||||||
log_message "Using i3-msg to focus workspace..."
|
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
|
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
|
sleep 1
|
||||||
|
|
||||||
# Check if focus is actually fixed now
|
# 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!"
|
log_message "Focus recovery successful!"
|
||||||
else
|
else
|
||||||
log_message "Focus still broken - restarting i3..."
|
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"
|
log_message "Restart command sent"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user