mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
fix: log an empty focused-app or touch-mode property as none
This commit is contained in:
1 parent
f96e1b2b6e
commit
2896e0a945
1 file changed
+10
-2
@@ -441,17 +441,25 @@ case $mode in
|
||||
# A finger that clicks but won't scroll, or touch that stops once a pad is used, shows here as
|
||||
# the mode in force at that moment. 4 is touch passed through, 1 a left-click mouse.
|
||||
[ -z "${BL_DESKTOP:-}" ] && (
|
||||
# What follows "=" in an xprop line, or $2 for a property that is missing or has no value
|
||||
# yet ("NAME(CARDINAL) =", which read leaves with nothing after the "=").
|
||||
xprop_value() {
|
||||
case $1 in *'not found'*|*=) echo "$2"; return ;; esac
|
||||
local v=${1#*=}
|
||||
v=${v# }
|
||||
echo "${v:-$2}"
|
||||
}
|
||||
tmode= app=
|
||||
xprop -spy -root STEAM_TOUCH_CLICK_MODE GAMESCOPE_FOCUSED_APP 2>/dev/null | while read -r line; do
|
||||
case $line in
|
||||
STEAM_TOUCH_CLICK_MODE*)
|
||||
v=${line##*= }; case $line in *'not found'*) v=unset ;; esac
|
||||
v=$(xprop_value "$line" unset)
|
||||
[ "$v" = "$tmode" ] && continue
|
||||
tmode=$v
|
||||
echo "== touch mode: $tmode (focused app ${app:-?}) at $(date +%T)"
|
||||
;;
|
||||
GAMESCOPE_FOCUSED_APP*)
|
||||
v=${line##*= }; case $line in *'not found'*) v=none ;; esac
|
||||
v=$(xprop_value "$line" none)
|
||||
[ "$v" = "$app" ] && continue
|
||||
app=$v
|
||||
echo "== focused app: $app (touch mode ${tmode:-unset}) at $(date +%T)"
|
||||
|
||||
Reference in new issue
Block a user