diff --git a/include/sway/commands.h b/include/sway/commands.h index d975876e2..2c5a63d40 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -117,6 +117,7 @@ sway_cmd cmd_input; sway_cmd cmd_seat; sway_cmd cmd_ipc; sway_cmd cmd_kill; +sway_cmd cmd_lock; sway_cmd cmd_layout; sway_cmd cmd_log_colors; sway_cmd cmd_mark; diff --git a/include/sway/idle.h b/include/sway/idle.h index 7b9228fc2..e2a22e7e6 100644 --- a/include/sway/idle.h +++ b/include/sway/idle.h @@ -4,4 +4,5 @@ void idle_setup_seat(struct sway_server *server, struct sway_seat *seat); bool idle_init(struct sway_server *server); +void invoke_swaylock(); #endif diff --git a/sway/commands.c b/sway/commands.c index 40c6ec3da..ce696344f 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -167,6 +167,7 @@ static struct cmd_handler command_handlers[] = { { "focus", cmd_focus }, { "kill", cmd_kill }, { "layout", cmd_layout }, + { "lock", cmd_lock }, { "move", cmd_move }, { "opacity", cmd_opacity }, { "reload", cmd_reload }, diff --git a/sway/commands/lock.c b/sway/commands/lock.c new file mode 100644 index 000000000..b4495ad65 --- /dev/null +++ b/sway/commands/lock.c @@ -0,0 +1,11 @@ +#include +#include "log.h" +#include "sway/commands.h" +#include "sway/idle.h" + +struct cmd_results *cmd_lock(int argc, char **argv) { + + invoke_swaylock(); + + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} diff --git a/sway/meson.build b/sway/meson.build index 9c23332a6..f85bc43a3 100644 --- a/sway/meson.build +++ b/sway/meson.build @@ -37,6 +37,7 @@ sway_sources = files( 'commands/focus_follows_mouse.c', 'commands/fullscreen.c', 'commands/kill.c', + 'commands/lock.c', 'commands/opacity.c', 'commands/include.c', 'commands/input.c',