mirror of
https://github.com/swaywm/swayidle
synced 2024-09-29 17:36:54 +02:00
introduce an after-resume argument
… but still not implemented
This commit is contained in:
parent
05d7ffe755
commit
ec102c1478
2 changed files with 23 additions and 0 deletions
19
main.c
19
main.c
|
@ -32,6 +32,7 @@ struct swayidle_state {
|
|||
struct wl_event_loop *event_loop;
|
||||
struct wl_list timeout_cmds; // struct swayidle_timeout_cmd *
|
||||
char *lock_cmd;
|
||||
char *after_resume_cmd;
|
||||
bool wait;
|
||||
} state;
|
||||
|
||||
|
@ -358,6 +359,21 @@ static int parse_sleep(int argc, char **argv) {
|
|||
return 2;
|
||||
}
|
||||
|
||||
static int parse_resume(int argc, char **argv) {
|
||||
if (argc < 2) {
|
||||
swayidle_log(LOG_ERROR, "Too few parameters to after-resume command. "
|
||||
"Usage: after-resume <command>");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
state.after_resume_cmd = parse_command(argc - 1, &argv[1]);
|
||||
if (state.after_resume_cmd) {
|
||||
swayidle_log(LOG_DEBUG, "Setup resume hook: %s", state.after_resume_cmd);
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int parse_args(int argc, char *argv[]) {
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "hdw")) != -1) {
|
||||
|
@ -390,6 +406,9 @@ static int parse_args(int argc, char *argv[]) {
|
|||
} else if (!strcmp("before-sleep", argv[i])) {
|
||||
swayidle_log(LOG_DEBUG, "Got before-sleep");
|
||||
i += parse_sleep(argc - i, &argv[i]);
|
||||
} else if (!strcmp("after-resume", argv[i])) {
|
||||
swayidle_log(LOG_DEBUG, "Got after-resume");
|
||||
i += parse_resume(argc - i, &argv[i]);
|
||||
} else {
|
||||
swayidle_log(LOG_ERROR, "Unsupported command '%s'", argv[i]);
|
||||
return 1;
|
||||
|
|
|
@ -46,6 +46,10 @@ Sending SIGUSR1 to swayidle will immediately enter idle state.
|
|||
the option InhibitDelayMaxSec. A command that has not finished by then will
|
||||
continue running after resuming from sleep.
|
||||
|
||||
*after-resume* <command>
|
||||
If built with systemd support, executes _command_ after logind signals that the
|
||||
computer resumed from sleep.
|
||||
|
||||
All commands are executed in a shell.
|
||||
|
||||
# EXAMPLE
|
||||
|
|
Loading…
Reference in a new issue