diff options
author | rbuj <[email protected]> | 2021-01-18 21:39:36 +0100 |
---|---|---|
committer | Luke from DC <[email protected]> | 2021-01-22 21:43:40 +0000 |
commit | 071933646ef80fff6295b581376d018ba8ddc39a (patch) | |
tree | 6d7b062669b526e2c21de06bb5e4512b424a42bd /mate-session/gsm-manager.c | |
parent | dfcbc043483a1f94e5da312629351e52d3d5b3cd (diff) | |
download | mate-session-manager-071933646ef80fff6295b581376d018ba8ddc39a.tar.bz2 mate-session-manager-071933646ef80fff6295b581376d018ba8ddc39a.tar.xz |
Support xscreensaver when mate-screensaver is not available
Diffstat (limited to 'mate-session/gsm-manager.c')
-rw-r--r-- | mate-session/gsm-manager.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c index 817688a..4be8eb0 100644 --- a/mate-session/gsm-manager.c +++ b/mate-session/gsm-manager.c @@ -1224,21 +1224,33 @@ sleep_lock_is_enabled (GsmManager *manager) static void manager_perhaps_lock (GsmManager *manager) { - GError *error; - gboolean ret; + gchar **screen_locker_command; - /* only lock if mate-screensaver is set to lock */ - if (!sleep_lock_is_enabled (manager)) { - return; - } + if ((screen_locker_command = gsm_get_screen_locker_command ()) != NULL) { + GError *error = NULL; - /* do this sync to ensure it's on the screen when we start suspending */ - error = NULL; - ret = g_spawn_command_line_sync ("mate-screensaver-command --lock", NULL, NULL, NULL, &error); - if (!ret) { - g_warning ("Couldn't lock screen: %s", error->message); - g_error_free (error); + /* only lock if mate-screensaver is set to lock */ + if (!g_strcmp0 (screen_locker_command[0], "mate-screensaver-command") && + !sleep_lock_is_enabled (manager)) { + goto clear_screen_locker_command; + } + + /* do this sync to ensure it's on the screen when we start suspending */ + g_spawn_sync (NULL, screen_locker_command, NULL, G_SPAWN_DEFAULT, + NULL, NULL, NULL, NULL, NULL, &error); + + if (error) { + g_warning ("Couldn't lock screen: %s", error->message); + g_error_free (error); + } + + } else { + g_warning ("Couldn't find any screen locker"); } + +clear_screen_locker_command: + + g_strfreev (screen_locker_command); } static void |