File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ finish-args:
2020 - ' --socket=fallback-x11'
2121 - ' --socket=wayland'
2222 - ' --filesystem=home'
23+ - ' --system-talk-name=org.freedesktop.Accounts'
2324
2425# This section is where you list all the source code required to build your app.
2526# If we had external dependencies that weren't included in our SDK, we would list
Original file line number Diff line number Diff line change @@ -46,11 +46,30 @@ namespace Resizer {
4646 }
4747
4848 protected override void activate () {
49+ set_theme();
50+
4951 window = new Window ();
5052 window. set_application (this );
5153 window. show_all ();
5254 }
5355
56+ private void set_theme (){
57+ var sys_settings = Granite . Settings . get_default ();
58+ var settings = Gtk . Settings . get_default ();
59+
60+ settings. gtk_application_prefer_dark_theme = is_dark_theme_prefered(sys_settings, settings);
61+
62+ /* be notified when system theme is changed and change accordingly */
63+ sys_settings. notify[" prefers-color-scheme" ]. connect (() = > {
64+ settings. gtk_application_prefer_dark_theme = is_dark_theme_prefered(sys_settings, settings);
65+ });
66+ }
67+
68+ private bool is_dark_theme_prefered (Granite .Settings sys_settings , Gtk .Settings settings ){
69+ return (sys_settings. prefers_color_scheme == Granite . Settings . ColorScheme . DARK );
70+ }
71+
72+
5473 public static int main (string [] args ) {
5574 var app = new Application ();
5675 return app. run (args);
You can’t perform that action at this time.
0 commit comments