From 11fedfe00a34bc986efede88e1f2d2e8000881ab Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 20 Jan 2019 01:10:51 +0100 Subject: mate-screensaver-command: Support unlocking (--unlock) the screensaver via CLI. --- src/gs-listener-dbus.c | 7 +++++++ src/mate-screensaver-command.c | 10 ++++++++++ 2 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/gs-listener-dbus.c b/src/gs-listener-dbus.c index d398601..a37e3f9 100644 --- a/src/gs-listener-dbus.c +++ b/src/gs-listener-dbus.c @@ -1373,6 +1373,8 @@ do_introspect (DBusConnection *connection, " \n" " \n" " \n" + " \n" + " \n" " \n" " \n" " \n" @@ -1465,6 +1467,11 @@ listener_dbus_handle_session_message (DBusConnection *connection, g_signal_emit (listener, signals [LOCK], 0); return DBUS_HANDLER_RESULT_HANDLED; } + if (dbus_message_is_method_call (message, GS_LISTENER_SERVICE, "Unlock")) + { + gs_listener_set_active (listener, FALSE); + return DBUS_HANDLER_RESULT_HANDLED; + } if (dbus_message_is_method_call (message, GS_LISTENER_SERVICE, "Quit")) { g_signal_emit (listener, signals [QUIT], 0); diff --git a/src/mate-screensaver-command.c b/src/mate-screensaver-command.c index 11feb8b..60c6001 100644 --- a/src/mate-screensaver-command.c +++ b/src/mate-screensaver-command.c @@ -39,6 +39,7 @@ static gboolean do_quit = FALSE; static gboolean do_lock = FALSE; +static gboolean do_unlock = FALSE; static gboolean do_cycle = FALSE; static gboolean do_activate = FALSE; static gboolean do_deactivate = FALSE; @@ -70,6 +71,10 @@ static GOptionEntry entries [] = "lock", 'l', 0, G_OPTION_ARG_NONE, &do_lock, N_("Tells the running screensaver process to lock the screen immediately"), NULL }, + { + "unlock", 'u', 0, G_OPTION_ARG_NONE, &do_unlock, + N_("Tells the running screensaver process to unlock the screen immediately"), NULL + }, { "cycle", 'c', 0, G_OPTION_ARG_NONE, &do_cycle, N_("If the screensaver is active then switch to another graphics demo"), NULL @@ -423,6 +428,11 @@ do_command (DBusConnection *connection) reply = screensaver_send_message_void (connection, "Lock", FALSE); } + if (do_unlock) + { + reply = screensaver_send_message_void (connection, "Unlock", FALSE); + } + if (do_cycle) { reply = screensaver_send_message_void (connection, "Cycle", FALSE); -- cgit v1.2.1