Skip to content

Commit

Permalink
misc: Flatten windowraise
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic2kk committed Jun 9, 2024
1 parent ea1319a commit 6f03fe9
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -13919,36 +13919,36 @@ function togWindows {
function windowraise {
if [ ! -f "$STLMINWIN" ]; then
writelog "SKIP" "${FUNCNAME[0]} - Skipping, because no minimized window file STLMINWIN found"
else
while read -r WN; do
WINNAME="${WN##*[[:blank:]]}"
writelog "INFO" "${FUNCNAME[0]} - Raising '$WINNAME'"
"$XDO" "${FUNCNAME[0]}" "$WINNAME"
COUNTER=0
MAXTRY=3
while grep -q "_NET_WM_STATE_HIDDEN" -q <<< "$("$XPROP" -id "$WINNAME")"; do
if [[ "$COUNTER" -ge "$MAXTRY" ]]; then
echo "$WINNAME" >> "${STLMINWIN}_lazy"
break
else
writelog "INFO" "${FUNCNAME[0]} - '$WINNAME' minimized after $COUNTER tries - raising again"
"$XDO" "${FUNCNAME[0]}" "$WINNAME"
COUNTER=$((COUNTER+1))
fi
done

done < "$STLMINWIN"
return
fi

if [ -f "${STLMINWIN}_lazy" ]; then
while read -r WN; do
WINNAME="${WN##*[[:blank:]]}"
writelog "INFO" "${FUNCNAME[0]} - Raising lazy '$WINNAME'"
while read -r WN; do
WINNAME="${WN##*[[:blank:]]}"
writelog "INFO" "${FUNCNAME[0]} - Raising '$WINNAME'"
"$XDO" "${FUNCNAME[0]}" "$WINNAME"
COUNTER=0
MAXTRY=3
while grep -q "_NET_WM_STATE_HIDDEN" -q <<< "$("$XPROP" -id "$WINNAME")"; do
if [[ "$COUNTER" -ge "$MAXTRY" ]]; then
echo "$WINNAME" >> "${STLMINWIN}_lazy"
break
else
writelog "INFO" "${FUNCNAME[0]} - '$WINNAME' minimized after $COUNTER tries - raising again"
"$XDO" "${FUNCNAME[0]}" "$WINNAME"
done < "${STLMINWIN}_lazy"
fi
COUNTER=$((COUNTER+1))
fi
done
done < "$STLMINWIN"

rm "$STLMINWIN" "${STLMINWIN}_lazy" 2>/dev/null
if [ -f "${STLMINWIN}_lazy" ]; then
while read -r WN; do
WINNAME="${WN##*[[:blank:]]}"
writelog "INFO" "${FUNCNAME[0]} - Raising lazy '$WINNAME'"
"$XDO" "${FUNCNAME[0]}" "$WINNAME"
done < "${STLMINWIN}_lazy"
fi

rm "$STLMINWIN" "${STLMINWIN}_lazy" 2>/dev/null
}

if [ "$TOGGLEWINDOWS" -eq 1 ]; then
Expand Down

0 comments on commit 6f03fe9

Please sign in to comment.