Add lock command for invoking swaylock_command

Add lock command to be able to bind a key to invoke the lock command
specified by swaylock_command
This commit is contained in:
Mattias Eriksson 2018-04-24 19:55:37 +02:00
parent 61cc0c67fe
commit 146a22290e
5 changed files with 15 additions and 0 deletions

View file

@ -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;

View file

@ -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

View file

@ -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 },

11
sway/commands/lock.c Normal file
View file

@ -0,0 +1,11 @@
#include <wlr/util/log.h>
#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);
}

View file

@ -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',