sane-input-handler: fix that input events werent suppressed during screen-off
note that this doesn't fix input gating during the screenoff-after-inactivity case.
This commit is contained in:
parent
6fb5cedd69
commit
0f97e3d7ed
|
@ -85,21 +85,38 @@ log() {
|
||||||
|
|
||||||
## HELPERS
|
## HELPERS
|
||||||
|
|
||||||
isTouchOn() {
|
# swaySetOutput true|false
|
||||||
# success if all touch inputs have their events enabled
|
# turns the display on or off
|
||||||
|
swaySetOutput() {
|
||||||
|
swaymsg -- output '*' power "$1"
|
||||||
|
}
|
||||||
|
# swaySetTouch enabled|disabled
|
||||||
|
# turns touch input on or off
|
||||||
|
swaySetTouch() {
|
||||||
|
# XXX(2024/06/09): `type:touch` method is documented, but now silently fails
|
||||||
|
# swaymsg -- input type:touch events "$1"
|
||||||
|
|
||||||
|
local inputs=$(swaymsg -t get_inputs --raw | jq '. | map(select(.type == "touch")) | map(.identifier) | join(" ")' --raw-output)
|
||||||
|
for id in "${inputs[@]}"; do
|
||||||
|
swaymsg -- input "$id" events "$1"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# success if all touch inputs have their events enabled
|
||||||
|
swayGetTouch() {
|
||||||
swaymsg -t get_inputs --raw \
|
swaymsg -t get_inputs --raw \
|
||||||
| jq --exit-status '. | map(select(.type == "touch")) | all(.libinput.send_events == "enabled")' \
|
| jq --exit-status '. | map(select(.type == "touch")) | all(.libinput.send_events == "enabled")' \
|
||||||
> /dev/null
|
> /dev/null
|
||||||
}
|
}
|
||||||
isScreenOn() {
|
# success if all outputs have power
|
||||||
# success if all outputs have power
|
swayGetOutput() {
|
||||||
swaymsg -t get_outputs --raw \
|
swaymsg -t get_outputs --raw \
|
||||||
| jq --exit-status '. | all(.power)' \
|
| jq --exit-status '. | all(.power)' \
|
||||||
> /dev/null
|
> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
isAllOn() {
|
isAllOn() {
|
||||||
isTouchOn && isScreenOn
|
swayGetOutput && swayGetTouch
|
||||||
}
|
}
|
||||||
|
|
||||||
isInhibited() {
|
isInhibited() {
|
||||||
|
@ -134,12 +151,12 @@ unmapped() {
|
||||||
}
|
}
|
||||||
|
|
||||||
allOn() {
|
allOn() {
|
||||||
swaymsg -- output '*' power true
|
swaySetOutput true
|
||||||
swaymsg -- input type:touch events enabled
|
swaySetTouch enabled
|
||||||
}
|
}
|
||||||
allOff() {
|
allOff() {
|
||||||
swaymsg -- output '*' power false
|
swaySetOutput false
|
||||||
swaymsg -- input type:touch events disabled
|
swaySetTouch disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleKeyboard() {
|
toggleKeyboard() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user