Skip to content

Commit f40377b

Browse files
committed
Rework scheme variant setting for apps
1 parent 10d8d34 commit f40377b

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

lib/Models/Application.vala

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,24 @@ public class He.Application : Gtk.Application {
7171
}
7272

7373
/**
74-
* A scheme variant to use for the application. If not set, the user's preferred scheme will be used.
75-
* This is especially useful for applications with their own color needs, such as media applications using the Content variant.
74+
* Sets the scheme variant to use for the application as Content.
75+
* This is especially useful for applications with their own color needs, such as media apps.
7676
*/
77-
public SchemeVariant? default_scheme_variant = null;
77+
private bool _is_content = false;
78+
public bool is_content {
79+
get { return _is_content; }
80+
set { _is_content = value; update_style_manager (); }
81+
}
82+
83+
/**
84+
* Sets the scheme variant to use for the application as Monochrome.
85+
* This is especially useful for applications with their own color needs, such as image apps.
86+
*/
87+
private bool _is_mono = false;
88+
public bool is_mono {
89+
get { return _is_mono; }
90+
set { _is_mono = value; update_style_manager (); }
91+
}
7892

7993
private void update_style_manager () {
8094
if (default_accent_color != null && override_accent_color) {
@@ -85,8 +99,10 @@ public class He.Application : Gtk.Application {
8599
style_manager.accent_color = default_accent_color;
86100
}
87101

88-
if (default_scheme_variant != null) {
89-
style_manager.scheme_variant = default_scheme_variant;
102+
if (is_content) {
103+
style_manager.scheme_variant = SchemeVariant.CONTENT;
104+
} else if (is_mono) {
105+
style_manager.scheme_variant = SchemeVariant.MONOCHROME;
90106
} else {
91107
style_manager.scheme_variant = desktop.ensor_scheme.to_variant ();
92108
}

0 commit comments

Comments
 (0)