Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 15 additions & 1 deletion src/components/dock/dock.vala
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ namespace Singularity {
private GtkLayerShell.Edge _reveal_barrier_edge = GtkLayerShell.Edge.BOTTOM;
private int _last_dimension = 0;
private int _current_margin = 0;
private int _rest_margin = 0;
private bool _menu_open = false;
private Gee.ArrayList<Singularity.DockContextMenuProvider> _menu_providers =
new Gee.ArrayList<Singularity.DockContextMenuProvider>();
Expand Down Expand Up @@ -453,16 +454,19 @@ namespace Singularity {
set_margin(this, GtkLayerShell.Edge.LEFT, 0);
set_margin(this, GtkLayerShell.Edge.RIGHT, 0);
set_margin(this, GtkLayerShell.Edge.TOP, 0);
_rest_margin = 0;
if (dock_style == "panel") {
_current_margin = 0;
return;
}
if (pos == "left") {
_current_margin = gap;
_rest_margin = gap;
set_margin(this, GtkLayerShell.Edge.LEFT, gap);
main_container.margin_end = gap + magnifier.headroom(true);
} else if (pos == "right") {
_current_margin = gap;
_rest_margin = gap;
set_margin(this, GtkLayerShell.Edge.RIGHT, gap);
main_container.margin_start = gap + magnifier.headroom(true);
} else {
Expand All @@ -471,7 +475,8 @@ namespace Singularity {
// container's bottom margin. Pull the surface down by that
// much so the shadow is not clipped at the surface edge,
// while the dock stays at the same visual gap (#162).
set_margin(this, GtkLayerShell.Edge.BOTTOM, int.max(0, gap - 21));
_rest_margin = int.max(0, gap - 21);
set_margin(this, GtkLayerShell.Edge.BOTTOM, _rest_margin);
main_container.margin_top = gap + magnifier.headroom(true);
}
}
Expand Down Expand Up @@ -870,6 +875,15 @@ namespace Singularity {
if (changed) app_system.config_changed("dock-reservation");
}

public int shown_extent() {
if (!_enabled || hidden_by_scrolling_tiling()) return 0;
int headroom = dock_style == "panel" ? 0 : magnifier.headroom(true);
int body = _last_dimension > 10
? _last_dimension - SHADOW_BOTTOM_PX - headroom
: _settings.get_int("dock-icon-size") + 20 + _settings.get_int("dock-gap");
return int.max(0, body) + _rest_margin;
}

private void update_autohide_state() {
if (hidden_by_scrolling_tiling()) {
_set_reveal_barrier_active(false);
Expand Down
26 changes: 20 additions & 6 deletions src/components/overview/overview.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace Singularity {

public bool showing { get; private set; default = false; }

public Singularity.Dock? dock { get; set; default = null; }

// True when the keyboard focus is on something the user is typing
// into (Entry, TextView, etc.) - used to suppress the
// "redirect to search bar" behavior so notes / calculator widgets
Expand Down Expand Up @@ -392,15 +394,27 @@ namespace Singularity {
if (grid_mon == null) return;
Gdk.Rectangle gg = grid_mon.get_geometry();
int avail = gg.width - 48;
int avail_h = gg.height;
string dock_pos = desktop_settings.get_string("dock-position");
if ((dock_pos == "left" || dock_pos == "right")
&& !desktop_settings.get_boolean("dock-autohide")) {
int isz = desktop_settings.get_int("dock-icon-size");
if (isz <= 0) isz = 48;
avail -= isz + desktop_settings.get_int("dock-gap") + 28;
int dock_extent = dock != null ? dock.shown_extent() : 0;
content_stack.margin_bottom = 0;
content_stack.margin_start = 0;
content_stack.margin_end = 0;
if (dock_pos == "left" || dock_pos == "right") {
if (dock == null && !desktop_settings.get_boolean("dock-autohide")) {
int isz = desktop_settings.get_int("dock-icon-size");
if (isz <= 0) isz = 48;
dock_extent = isz + desktop_settings.get_int("dock-gap") + 28;
}
avail -= dock_extent;
if (dock_pos == "left") content_stack.margin_start = dock_extent;
else content_stack.margin_end = dock_extent;
} else {
content_stack.margin_bottom = dock_extent;
avail_h -= dock_extent;
}
launcher_grid.set_columns_for_width(avail);
launcher_grid.viewport_hint = gg.height;
launcher_grid.viewport_hint = avail_h;
}

private void animate_stage(bool entering) {
Expand Down
2 changes: 2 additions & 0 deletions src/core/main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,7 @@ public class SingularityApp : Singularity.ShellApplication, Singularity.Shell.Sh
} else {
dock = new Singularity.Dock(this);
}
if (overview != null) overview.dock = dock;
connect_shell_signals();
if (hot_corner_manager != null) {
if (panel != null) hot_corner_manager.attach_to_panel(panel);
Expand Down Expand Up @@ -991,6 +992,7 @@ public class SingularityApp : Singularity.ShellApplication, Singularity.Shell.Sh
private void ensure_overview() {
if (overview != null) return;
overview = new Singularity.Overview(this, panel);
overview.dock = dock;
overview.shown.connect(() => {
set_tiling_layout_hold(overview, true);
if (panel != null) panel.set_overview_mode(true);
Expand Down
Loading