Skip to content

Commit

Permalink
add option to start swayidle in locked state
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamjan committed Oct 5, 2020
1 parent aa11c41 commit 3058157
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ enum log_importance {

static enum log_importance verbosity = LOG_INFO;

static bool lock_on_start = false;

static void swayidle_log(enum log_importance importance, const char *fmt, ...) {
if (importance < verbosity) {
return;
Expand Down Expand Up @@ -780,7 +782,7 @@ static int parse_idlehint(int argc, char **argv) {

static int parse_args(int argc, char *argv[], char **config_path) {
int c;
while ((c = getopt(argc, argv, "C:hdwS:")) != -1) {
while ((c = getopt(argc, argv, "C:hdwlS:")) != -1) {
switch (c) {
case 'C':
*config_path = strdup(optarg);
Expand All @@ -794,6 +796,9 @@ static int parse_args(int argc, char *argv[], char **config_path) {
case 'S':
state.seat_name = strdup(optarg);
break;
case 'l':
lock_on_start = true;
break;
case 'h':
case '?':
printf("Usage: %s [OPTIONS]\n", argv[0]);
Expand Down Expand Up @@ -1067,6 +1072,11 @@ int main(int argc, char *argv[]) {
display_event, NULL);
wl_event_source_check(source);


if (lock_on_start) {
kill(getpid(), SIGUSR1);
}

while (wl_event_loop_dispatch(state.event_loop, -1) != 1) {
// This space intentionally left blank
}
Expand Down
4 changes: 4 additions & 0 deletions swayidle.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ swayidle - Idle manager for Wayland
*-S* <seat-name>
Specify which seat to use. By default, if no name is specified, an arbitrary seat will be picked instead.

*-l*
Lock the screen when swayidle starts. Useful in case of auto-login, when we want the wayland session
automatically started, but locked.

# DESCRIPTION

swayidle listens for idle activity on your Wayland compositor and executes tasks
Expand Down

0 comments on commit 3058157

Please sign in to comment.