Skip to content
Permalink
Browse files

mate-screensaver-command: Support unlocking (--unlock) the screensave…

…r via CLI.
  • Loading branch information...
sunweaver authored and raveit65 committed Jan 20, 2019
1 parent 84a14f0 commit 11fedfe00a34bc986efede88e1f2d2e8000881ab
Showing with 29 additions and 0 deletions.
  1. +3 −0 data/mate-screensaver-command.1
  2. +9 −0 doc/dbus-interface.xml
  3. +7 −0 src/gs-listener-dbus.c
  4. +10 −0 src/mate-screensaver-command.c
@@ -35,6 +35,9 @@ Query the length of time the screensaver has been active
.B \-l, \-\-lock
Tells the running screensaver process to lock the screen immediately
.TP
.B \-u, \-\-unlock
Tells the running screensaver process to unlock the screen immediately
.TP
.B \-c, \-\-cycle
If the screensaver is active then switch to another graphics demo
.TP
@@ -52,6 +52,15 @@
</para>
</sect2>

<sect2 id="gs-method-Unlock">
<title>
<literal>Unlock</literal>
</title>
<para>
Request that the screen be unlocked.
</para>
</sect2>

<sect2 id="gs-method-Cycle">
<title>
<literal>Cycle</literal>
@@ -1373,6 +1373,8 @@ do_introspect (DBusConnection *connection,
" <interface name=\"org.mate.ScreenSaver\">\n"
" <method name=\"Lock\">\n"
" </method>\n"
" <method name=\"Unlock\">\n"
" </method>\n"
" <method name=\"Cycle\">\n"
" </method>\n"
" <method name=\"SimulateUserActivity\">\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);
@@ -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);

0 comments on commit 11fedfe

Please sign in to comment.
You can’t perform that action at this time.