Skip to content

Commit 107af70

Browse files
committed
Follow use-transparency setting
1 parent e959a9e commit 107af70

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

data/application.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ window,
4747
background: alpha(@base_color, 0.8);
4848
}
4949

50+
.notification.reduce-transparency .draw-area {
51+
margin: 16px;
52+
background: @base_color;
53+
}
54+
5055
.notification:not(.confirmation) .draw-area image {
5156
-gtk-icon-style: regular;
5257
}

src/AbstractBubble.vala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public class Notifications.AbstractBubble : Gtk.Window {
2727

2828
protected Gtk.Stack content_area;
2929

30+
private static Settings? transparency_settings;
31+
3032
private Gtk.Revealer close_revealer;
3133
private Gtk.Box draw_area;
3234

@@ -36,6 +38,12 @@ public class Notifications.AbstractBubble : Gtk.Window {
3638
private Pantheon.Desktop.Shell? desktop_shell;
3739
private Pantheon.Desktop.Panel? desktop_panel;
3840

41+
static construct {
42+
var transparency_schema = SettingsSchemaSource.get_default ().lookup ("io.elementary.desktop.wingpanel", true);
43+
if (transparency_schema != null && transparency_schema.has_key ("use-transparency")) {
44+
transparency_settings = new Settings ("io.elementary.desktop.wingpanel");
45+
}
46+
}
3947

4048
construct {
4149
content_area = new Gtk.Stack () {
@@ -117,6 +125,17 @@ public class Notifications.AbstractBubble : Gtk.Window {
117125
init_x ();
118126
}
119127
});
128+
129+
transparency_settings.changed["use-transparency"].connect (update_transparency);
130+
update_transparency ();
131+
}
132+
133+
private void update_transparency () requires (transparency_settings != null) {
134+
if (transparency_settings.get_boolean ("use-transparency")) {
135+
remove_css_class ("reduce-transparency");
136+
} else {
137+
add_css_class ("reduce-transparency");
138+
}
120139
}
121140

122141
public new void present () {

0 commit comments

Comments
 (0)