Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to start swayidle in locked state #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ static const char *verbosity_colors[] = {
[LOG_DEBUG ] = "\x1B[1;30m",
};

static bool lock_on_start = false;

static enum log_importance log_importance = LOG_INFO;

void swayidle_log_init(enum log_importance verbosity) {
Expand Down Expand Up @@ -827,7 +829,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':
free(*config_path);
Expand All @@ -842,6 +844,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 @@ -1118,6 +1123,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