From f192e262ea6d9905d29cf9ad8b0e76f463f9f475 Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Thu, 26 Oct 2017 14:17:27 +0200 Subject: Add support for numlockx. Ported from slick-greeter: From 82d912b8fe98e01c80a59e3c010b1bbb18c859b0 Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Tue, 11 Jul 2017 16:57:23 +0200 Subject: [PATCH 1/1] Add support for numlockx --- data/org.ArcticaProject.arctica-greeter.gschema.xml | 4 ++++ debian/control | 1 + src/arctica-greeter.vala | 16 ++++++++++++++++ src/settings.vala | 1 + 4 files changed, 22 insertions(+) diff --git a/data/org.ArcticaProject.arctica-greeter.gschema.xml b/data/org.ArcticaProject.arctica-greeter.gschema.xml index e870a38..7e8adc8 100644 --- a/data/org.ArcticaProject.arctica-greeter.gschema.xml +++ b/data/org.ArcticaProject.arctica-greeter.gschema.xml @@ -110,5 +110,9 @@ 'service.arctica-project.org' Default FQDN for host offering Remote Logon Service + + false + Whether to activate numlock. This features requires the installation of numlockx. + diff --git a/debian/control b/debian/control index 1cf0afe..7f0327c 100644 --- a/debian/control +++ b/debian/control @@ -48,6 +48,7 @@ Recommends: ayatana-indicator-application, ayatana-indicator-sound, network-manager-gnome, xinput, + numlockx, Provides: lightdm-greeter Breaks: edubuntu-artwork (<< 12.01.1~), diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index 0355534..94a1eb0 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -580,6 +580,16 @@ public class ArcticaGreeter greeter_ready (); } + private static void activate_numlock () + { + try { + Process.spawn_command_line_sync("/usr/bin/numlockx on", null, null, null); + } + catch (Error e){ + warning ("Error while activating numlock: %s", e.message); + } + } + public static int main (string[] args) { /* Protect memory from being paged to disk, as we deal with passwords */ @@ -641,6 +651,12 @@ public class ArcticaGreeter if (do_test_mode) debug ("Running in test mode"); + /* Set the numlock state */ + if (AGSettings.get_boolean (AGSettings.KEY_ACTIVATE_NUMLOCK)) { + debug ("Activating numlock"); + activate_numlock (); + } + Pid atspi_pid = 0; if (!do_test_mode) { diff --git a/src/settings.vala b/src/settings.vala index a888a96..e55b0c2 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -43,6 +43,7 @@ public class AGSettings public const string KEY_HIDDEN_USERS = "hidden-users"; public const string KEY_GROUP_FILTER = "group-filter"; public const string KEY_IDLE_TIMEOUT = "idle-timeout"; + public const string KEY_ACTIVATE_NUMLOCK = "activate-numlock"; public const string KEY_REMOTE_SERVICE_FQDN = "remote-service-fqdn"; public const string KEY_TOGGLEBOX_FONT_FGCOLOR = "togglebox-font-fgcolor"; public const string KEY_TOGGLEBOX_BUTTON_BGCOLOR = "togglebox-button-bgcolor"; -- cgit v1.2.3