Skip to content

Commit

Permalink
MainWindow: respect reduce transparency key (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Dec 10, 2024
1 parent 8b2120d commit fba1c76
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
21 changes: 13 additions & 8 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@
*/

dock {
background: alpha(@bg_color, 0.6);
background: @bg_color;
border-radius: 9px;
box-shadow:
inset 0 -1px 0 0 alpha(@highlight_color, 0.1),
inset 0 1px 0 0 alpha(@highlight_color, 0.15),
inset 1px 0 0 0 alpha(@highlight_color, 0.035),
inset -1px 0 0 0 alpha(@highlight_color, 0.035),
0 0 0 1px alpha(@borders, 0.4),
0 1px 3px alpha(black, 0.10),
0 3px 9px alpha(black, 0.15);
inset 0 -1px 0 0 alpha(@highlight_color, 0.2),
inset 0 1px 0 0 alpha(@highlight_color, 0.3),
inset 1px 0 0 0 alpha(@highlight_color, 0.07),
inset -1px 0 0 0 alpha(@highlight_color, 0.07),
0 0 0 1px @borders,
0 1px 3px alpha(black, 0.2),
0 3px 9px alpha(black, 0.3);
opacity: 0.6;
padding: 9px;
}

dock.reduce-transparency {
opacity: 1;
}

dock-window {
margin-top: 64px; /* Keep enough room so that icons don't clip when bouncing */
}
Expand Down
1 change: 1 addition & 0 deletions data/dock.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<issue url="https://github.com/elementary/dock/issues/275">app bounce clips app icon</issue>
<issue url="https://github.com/elementary/dock/issues/317">Multitasking view bouncing continues for far too long</issue>
<issue url="https://github.com/elementary/dock/issues/321">The dots of active apps on the dock sometimes appear touching the icons without proper spacing</issue>
<issue url="https://github.com/elementary/dock/issues/331">Respect Reduce Transparency setting</issue>
</issues>
</release>

Expand Down
20 changes: 20 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,29 @@

public class Dock.MainWindow : Gtk.ApplicationWindow {
private class Container : Gtk.Box {
private Settings transparency_settings;

class construct {
set_css_name ("dock");
}

construct {
var transparency_schema = SettingsSchemaSource.get_default ().lookup ("io.elementary.desktop.wingpanel", true);
if (transparency_schema != null && transparency_schema.has_key ("use-transparency")) {
transparency_settings = new Settings ("io.elementary.desktop.wingpanel");
transparency_settings.changed["use-transparency"].connect (update_transparency);
update_transparency ();
}
}

private void update_transparency () {
if (transparency_settings.get_boolean ("use-transparency")) {
remove_css_class ("reduce-transparency");
} else {
add_css_class ("reduce-transparency");

}
}
}

private class BottomMargin : Gtk.Widget {
Expand Down

0 comments on commit fba1c76

Please sign in to comment.