diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..692fb6263 --- /dev/null +++ b/build.sh @@ -0,0 +1,7 @@ +sudo rm -fr build/ +sudo meson build +cd build/ +sudo ninja +sudo ninja install +cd ../ +sudo service lightdm restart diff --git a/lightdm-greeter-capture.sh b/lightdm-greeter-capture.sh new file mode 100755 index 000000000..104efe65a --- /dev/null +++ b/lightdm-greeter-capture.sh @@ -0,0 +1,4 @@ +#!/bin/bash +sleep 30 +DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root > /tmp/greeter.xwd +convert /tmp/greeter.xwd /home/$(whoami)/Pictures/greeter.png diff --git a/src/Cards/BaseCard.vala b/src/Cards/BaseCard.vala index 7e202ab6d..0433cd8a5 100644 --- a/src/Cards/BaseCard.vala +++ b/src/Cards/BaseCard.vala @@ -27,6 +27,9 @@ public abstract class Greeter.BaseCard : Gtk.Revealer { public bool connecting { get; set; default = false; } public bool need_password { get; set; default = false; } public bool use_fingerprint { get; set; default = false; } + + public int prefers_color_scheme { get; set; default = 0; } + public int prefers_accent_color { get; set; default = 0; } protected const int ERROR_SHAKE_DURATION = 450; diff --git a/src/Cards/UserCard.vala b/src/Cards/UserCard.vala index 02d2b0a36..d0de2b323 100644 --- a/src/Cards/UserCard.vala +++ b/src/Cards/UserCard.vala @@ -297,9 +297,6 @@ public class Greeter.UserCard : Greeter.BaseCard { private void update_style () { var gtksettings = Gtk.Settings.get_default (); gtksettings.gtk_theme_name = "io.elementary.stylesheet." + accent_to_string (prefers_accent_color); - - var style_provider = Gtk.CssProvider.get_named (gtksettings.gtk_theme_name, null); - password_entry_context.add_provider (style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); } private string accent_to_string (int i) { @@ -350,11 +347,12 @@ public class Greeter.UserCard : Greeter.BaseCard { ); is_24h = greeter_act.time_format != "12h"; - prefers_accent_color = greeter_act.prefers_accent_color; sleep_inactive_ac_timeout = greeter_act.sleep_inactive_ac_timeout; sleep_inactive_ac_type = greeter_act.sleep_inactive_ac_type; sleep_inactive_battery_timeout = greeter_act.sleep_inactive_battery_timeout; sleep_inactive_battery_type = greeter_act.sleep_inactive_battery_type; + prefers_color_scheme = greeter_act.prefers_color_scheme; + prefers_accent_color = greeter_act.prefers_accent_color; ((GLib.DBusProxy) greeter_act).g_properties_changed.connect ((changed_properties, invalidated_properties) => { string time_format; @@ -366,6 +364,13 @@ public class Greeter.UserCard : Greeter.BaseCard { changed_properties.lookup ("SleepInactiveACType", "i", out _sleep_inactive_ac_type); changed_properties.lookup ("SleepInactiveBatteryTimeout", "i", out _sleep_inactive_battery_timeout); changed_properties.lookup ("SleepInactiveBatteryType", "i", out _sleep_inactive_battery_type); + + int prefers_color_scheme_out; + changed_properties.lookup ("PrefersColorScheme", "i", out prefers_color_scheme_out); + prefers_color_scheme = prefers_color_scheme_out; + int prefers_accent_color_out; + changed_properties.lookup ("PrefersColorScheme", "i", out prefers_accent_color_out); + prefers_accent_color = prefers_accent_color_out; }); } catch (Error e) { critical (e.message); diff --git a/src/MainWindow.vala b/src/MainWindow.vala index ffb878a10..6199bdb80 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -306,6 +306,7 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { var rect = monitor.get_geometry (); resize (rect.width, rect.height); move (rect.x, rect.y); + user_style (); } private void create_session_selection_action () { @@ -540,6 +541,8 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { if (binding != null) { binding.unbind (); } + + user_style (); user_card.set_keyboard_layouts (); @@ -623,4 +626,49 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { carousel.scroll_to (next_card); } } + + + private void user_style () { + var gtksettings = Gtk.Settings.get_default (); + if (current_card.prefers_color_scheme == 1) { + gtksettings.gtk_application_prefer_dark_theme = true; + } else { + gtksettings.gtk_application_prefer_dark_theme = false; + } + switch (current_card.prefers_accent_color) { + case 1: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.strawberry"; + break; + case 2: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.orange"; + break; + case 3: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.banana"; + break; + case 4: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.lime"; + break; + case 5: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.mint"; + break; + case 6: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.blueberry"; + break; + case 7: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.grape"; + break; + case 8: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.bubblegum"; + break; + case 9: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.cocoa"; + break; + case 10: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.slate"; + break; + default: + gtksettings.gtk_theme_name = "io.elementary.stylesheet.blueberry"; + break; + } + } } diff --git a/src/PantheonAccountsServicePlugin.vala b/src/PantheonAccountsServicePlugin.vala index 3d67a51b6..e2dd1b8dd 100644 --- a/src/PantheonAccountsServicePlugin.vala +++ b/src/PantheonAccountsServicePlugin.vala @@ -2,8 +2,6 @@ interface Pantheon.AccountsService : Object { public abstract string time_format { owned get; set; } - public abstract int prefers_accent_color { get; set; } - [DBus (name = "SleepInactiveACTimeout")] public abstract int sleep_inactive_ac_timeout { get; set; } [DBus (name = "SleepInactiveACType")] @@ -11,6 +9,12 @@ interface Pantheon.AccountsService : Object { public abstract int sleep_inactive_battery_timeout { get; set; } public abstract int sleep_inactive_battery_type { get; set; } + + [DBus (name = "PrefersColorScheme")] + public abstract int prefers_color_scheme { get; set; } + + [DBus (name = "PrefersAccentColor")] + public abstract int prefers_accent_color { get; set; } } [DBus (name = "io.elementary.SettingsDaemon.AccountsService")]