sane-input-handler: tweak hold times
decrease power-hold-to-play/pause; increase power-double-tap timeout; straddle volume-hold: shorter time-to-first-hold but longer time-between-holds
This commit is contained in:
@@ -35,10 +35,16 @@ let
|
|||||||
;
|
;
|
||||||
in assert terminal -> events == []; events;
|
in assert terminal -> events == []; events;
|
||||||
|
|
||||||
# trigger ${button}_hold_N every `holdTime` ms until ${button} is released
|
# trigger ${button}_hold_N repeatedly for as long as ${button} is held.
|
||||||
recurseHold = button: { count ? 1, maxHolds ? 3, holdTime ? 1000 }@opts: {
|
# ${holdTimes[N]}: how long to wait after the N'th event before firing the event again.
|
||||||
|
# if the holdTimes list has fewer items than `maxHolds`, then the list is extended by duplicating its last item.
|
||||||
|
recurseHold = button: { count ? 1, maxHolds ? 5, holdTimes ? [ 500 3000 ] }@opts: {
|
||||||
trigger = "${button}_hold_${builtins.toString count}";
|
trigger = "${button}_hold_${builtins.toString count}";
|
||||||
ms = holdTime;
|
ms = if count <= builtins.length holdTimes then
|
||||||
|
builtins.elemAt holdTimes (count - 1)
|
||||||
|
else
|
||||||
|
lib.last holdTimes
|
||||||
|
;
|
||||||
} // lib.optionalAttrs (count < maxHolds) {
|
} // lib.optionalAttrs (count < maxHolds) {
|
||||||
timeout = recurseHold button (opts // { count = count+1; });
|
timeout = recurseHold button (opts // { count = count+1; });
|
||||||
# end the hold -> back to root state
|
# end the hold -> back to root state
|
||||||
@@ -130,11 +136,11 @@ in
|
|||||||
|
|
||||||
# map: power (tap), power (tap) x2
|
# map: power (tap), power (tap) x2
|
||||||
power_pressed.power_released.trigger = "power_tap_1";
|
power_pressed.power_released.trigger = "power_tap_1";
|
||||||
power_pressed.power_released.timeout.ms = 600; # max time within which a second power press will be recognized
|
power_pressed.power_released.timeout.ms = 750; # max time within which a second power press will be recognized
|
||||||
power_pressed.power_released.power_pressed.power_released.trigger = "power_tap_2";
|
power_pressed.power_released.power_pressed.power_released.trigger = "power_tap_2";
|
||||||
# map power (hold), power tap -> hold:
|
# map power (hold), power tap -> hold:
|
||||||
power_pressed.timeout.trigger = "power_hold";
|
power_pressed.timeout.trigger = "power_hold";
|
||||||
power_pressed.timeout.ms = 600;
|
power_pressed.timeout.ms = 500;
|
||||||
power_pressed.power_released.power_pressed.timeout.trigger = "power_tap_1_hold";
|
power_pressed.power_released.power_pressed.timeout.trigger = "power_tap_1_hold";
|
||||||
power_pressed.power_released.power_pressed.timeout.ms = 750; # this is a long timeout because it's tied to the "kill window" action.
|
power_pressed.power_released.power_pressed.timeout.ms = 750; # this is a long timeout because it's tied to the "kill window" action.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user