Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Night Light on unsupported hardware #118

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
6 changes: 4 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ public class Onboarding.MainWindow : Hdy.ApplicationWindow {
carousel.add (location_services_view);
}

var night_light_view = new NightLightView ();
carousel.add (night_light_view);
if (Utils.is_night_light_supported) {
var night_light_view = new NightLightView ();
carousel.add (night_light_view);
}

var housekeeping_view = new HouseKeepingView ();
carousel.add (housekeeping_view);
Expand Down
21 changes: 21 additions & 0 deletions src/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,25 @@ public class Utils {
return _logo_icon_name;
}
}

public static bool is_night_light_supported {
get {
try {
string standard_output;
int exit_status;
Process.spawn_command_line_sync ("/usr/bin/uname -p",
out standard_output,
null,
out exit_status);

if (exit_status == 0 && standard_output.strip () == "x86_64") {
return true;
}
} catch (SpawnError e) {
warning (e.message);
}

return false;
}
}
}