Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/Cards/UserCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/

public class Greeter.UserCard : Greeter.BaseCard {
/* We sync display settings once */
private static bool synced_display_settings = false;

public signal void go_left ();
public signal void go_right ();
public signal void focus_requested ();
Expand Down Expand Up @@ -288,6 +291,32 @@ public class Greeter.UserCard : Greeter.BaseCard {
main_box.show_all ();
}

private void set_display_settings () {
if (synced_display_settings) {
return;
}

var source_path = Path.build_filename ("/", "var", "lib", "lightdm-data", lightdm_user.name, "monitors.xml");
var source = File.new_for_path (source_path);

if (!source.query_exists ()) {
warning ("%s doesn't exist", source_path);
return;
}

var dest_path = Path.build_filename (GLib.Environment.get_user_config_dir (), "monitors.xml");
var dest = File.new_for_path (dest_path);

try {
source.copy (dest, OVERWRITE | ALL_METADATA);
} catch (Error e) {
warning (e.message);
return;
}

synced_display_settings = true;
}

private string accent_to_string (int i) {
switch (i) {
case 1:
Expand Down Expand Up @@ -360,6 +389,7 @@ public class Greeter.UserCard : Greeter.BaseCard {

set_background_image ();
set_check_style ();
set_display_settings ();

if (needs_settings_set) {
set_settings ();
Expand Down