Make idle timeout configurable

This commit is contained in:
Hannes Braun 2024-03-24 15:59:07 +01:00 committed by Leon Henrik Plickat
commit 2c10d982e7
Failed to generate hash of commit
2 changed files with 22 additions and 2 deletions

View file

@ -79,7 +79,7 @@ bool recreate_surface_on_close = false;
enum zwlr_layer_shell_v1_layer layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM;
struct ext_idle_notifier_v1 *idle_notifier = NULL;
const uint32_t neko_idle_timeout_ms = 180000; /* 3 minutes. */ // TODO make configurable
uint32_t neko_idle_timeout_ms = 180000; /* 3 minutes. */
struct Seat
{
@ -1414,6 +1414,18 @@ int main (int argc, char *argv[])
else if ( strcmp(a, "overlay") == 0 )
layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY;
}
else if ( strcmp(argv[i], "--idle-sleep") == 0 )
{
const char *a = get_argument(argc, argv, &i);
int timeout = atoi(a);
if (timeout > 0)
neko_idle_timeout_ms = (uint32_t) timeout * 1000;
else
{
fprintf(stderr, "ERROR: Invalid argument '%s' for flag '--idle-sleep'.\n", a);
return EXIT_FAILURE;
}
}
else
{
fprintf(stderr, "ERROR: Unknown option: %s\n", argv[i]);