From bda58f0b9583c3d67c8f56805d08b72e784adba8 Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Mon, 12 Mar 2018 21:07:48 +0100 Subject: 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 --- src/arctica-greeter.vala | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- cgit v1.2.3