summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2023-02-03 14:16:27 +1000
committerJosé Expósito <jose.exposito89@gmail.com>2023-02-06 18:02:58 +0000
commit41e7caac4852f2f7ff35a83fe6d40c6138fdf71f (patch)
treef039962eb5fe5948d38ce5bca5d1461d785f195c
parentbb21327efeb3280fb80c7d0427babe3be0a558c3 (diff)
downloadlibinput-41e7caac4852f2f7ff35a83fe6d40c6138fdf71f.tar.gz
tools: add --replay-after and --once to libinput replay
For the cases where it's not possible to hit enter to start the replay because e.g. we cannot change focus, etc. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--tools/libinput-replay.man7
-rwxr-xr-xtools/libinput-replay.py20
2 files changed, 26 insertions, 1 deletions
diff --git a/tools/libinput-replay.man b/tools/libinput-replay.man
index dcae907c..9eae92e1 100644
--- a/tools/libinput-replay.man
+++ b/tools/libinput-replay.man
@@ -15,6 +15,13 @@ simultaneously.
.TP 8
.B \-\-help
Print help
+.TP 8
+.B \-\-once
+Only replay the recording once, then exit.
+.TP 8
+.B \-\-replay-after=s
+Replay the recording after waiting for s seconds. This replaces the default
+interactive prompt to start the replay.
.SH NOTES
.PP
This tool replays events from a recording through the the kernel and is
diff --git a/tools/libinput-replay.py b/tools/libinput-replay.py
index 63f662fa..1a8fe700 100755
--- a/tools/libinput-replay.py
+++ b/tools/libinput-replay.py
@@ -269,7 +269,10 @@ def loop(args, recording):
return
while True:
- input("Hit enter to start replaying")
+ if args.replay_after >= 0:
+ time.sleep(args.replay_after)
+ else:
+ input("Hit enter to start replaying")
processes = []
for d in devices:
@@ -284,6 +287,9 @@ def loop(args, recording):
del processes
+ if args.once:
+ break
+
def create_device_quirk(device):
try:
@@ -363,6 +369,18 @@ def main():
type=str,
help="Path to device recording",
)
+ parser.add_argument(
+ "--replay-after",
+ type=int,
+ default=-1,
+ help="Automatically replay once after N seconds",
+ )
+ parser.add_argument(
+ "--once",
+ action="store_true",
+ default=False,
+ help="Stop and exit after one replay",
+ )
parser.add_argument("--verbose", action="store_true")
args = parser.parse_args()