diff options
author | Ikey Doherty <ikey@solus-project.com> | 2018-03-12 21:07:48 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-03-12 21:08:14 +0100 |
commit | bda58f0b9583c3d67c8f56805d08b72e784adba8 (patch) | |
tree | 241b3e2a0dc2577026b6b2ea9b8cf9c07d709626 | |
parent | 177dab0e53ea3fe15643343b1b0fd9178e4c3e09 (diff) | |
download | arctica-greeter-bda58f0b9583c3d67c8f56805d08b72e784adba8.tar.gz arctica-greeter-bda58f0b9583c3d67c8f56805d08b72e784adba8.tar.bz2 arctica-greeter-bda58f0b9583c3d67c8f56805d08b72e784adba8.zip |
greeter: Avoid expensive Python calls when it isn't needed.
On non Debian/Ubuntu systems, the /etc/default/keyboard path does not exist.
To prevent expensive Python startup (and hundreds/thousands of stats +
follow-up loads) we'll reduce to an initial early stat, i.e. if the
non-standard file exists only then will we exectute the helper stub.
This is most useful on systems that employ systemd for the X11 keyboard
configuration (`00-keyboard.conf` from systemd-localed) so that the X server
already has the correct layout upon starting up. This approach also avoids
unnecessary xkbcomp calls forcing recompilation of non-cached assets.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
-rw-r--r-- | src/arctica-greeter.vala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala index 76b2279..45a98ba 100644 --- a/src/arctica-greeter.vala +++ b/src/arctica-greeter.vala @@ -582,6 +582,12 @@ public class ArcticaGreeter private static void set_keyboard_layout () { + + /* Avoid expensive Python execution where possible */ + if (!FileUtils.test("/etc/default/keyboard", FileTest.EXISTS)) { + return; + } + try { Process.spawn_command_line_sync(Path.build_filename (Config.PKGLIBEXECDIR, "arctica-greeter-set-keyboard-layout"), null, null, null); } |