From 2b676b63b143c166a94a820b43d8ebe99ae9a762 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Nov 2022 21:54:51 +0530 Subject: [PATCH] sleep defaults to one second --- kitty/boss.py | 4 ++-- kitty/options/utils.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index ab078bd33..2f132f118 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -1774,8 +1774,8 @@ class Boss: else: doit() - @ac('misc', 'Sleep for the specified time period') - def sleep(self, sleep_time: float) -> None: + @ac('misc', 'Sleep for the specified time period. Suffix can be s for seconds, m, for minutes, h for hours and d for days. The time can be fractional.') + def sleep(self, sleep_time: float = 1.0) -> None: sleep(sleep_time) @ac('misc', 'Click a URL using the keyboard') diff --git a/kitty/options/utils.py b/kitty/options/utils.py index 0d5d27009..926aa63df 100644 --- a/kitty/options/utils.py +++ b/kitty/options/utils.py @@ -296,6 +296,7 @@ def single_integer_arg(func: str, rest: str) -> FuncArgsType: @func_with_args('sleep') def sleep(func: str, sleep_time: str) -> FuncArgsType: mult = 1 + sleep_time = sleep_time or '1' if sleep_time[-1] in 'shmd': mult = {'s': 1, 'm': 60, 'h': 3600, 'd': 24 * 3600}[sleep_time[-1]] sleep_time = sleep_time[:-1]