Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
18 changes: 18 additions & 0 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ dock {
opacity: 1;
}

dock-window:not(.reduce-transparency) separator.vertical {
border-right-color: alpha(@highlight_color, 0.15);
}

dock-window {
margin-top: 64px; /* Keep enough room so that icons don't clip when bouncing */
}
Expand Down Expand Up @@ -60,6 +64,7 @@ launcher progressbar progress {
min-width: 0;
}

backgrounditem,
icongroup {
padding: 6px;
padding-bottom: 0;
Expand Down Expand Up @@ -88,6 +93,19 @@ icongroup .add-image {
-gtk-icon-shadow: 0 1px 0 alpha(@highlight_color, 0.2);
}

backgrounditem header {
padding: 0.5em 1em;
}

/*Workaround for bug with headers in popover*/
backgrounditem header .heading {
margin: 0;
}

backgrounditem .close-button {
padding: 0.125em;
}

.reduce-transparency .add-image {
color: @selected_fg_color;
}
Expand Down
176 changes: 176 additions & 0 deletions data/background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/dock.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<gresources>
<gresource prefix="/io/elementary/dock">
<file compressed="true">Application.css</file>
<file compressed="true">background.svg</file>
<file compressed="true">poof.svg</file>
</gresource>
</gresources>
31 changes: 31 additions & 0 deletions src/AppSystem/Background/BackgroundApp.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* SPDX-License-Identifier: GPL-3.0
* SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io)
*
* Authored by: Leonhard Kargl <leo.kargl@proton.me>
*/

public class Dock.BackgroundApp : Object {
public DesktopAppInfo app_info { get; construct; }
public Icon icon { get { return app_info.get_icon (); } }
public string? instance { get; construct; }
public string? message { get; construct; }

public BackgroundApp (DesktopAppInfo app_info, string? instance, string? message) {
Object (app_info: app_info, instance: instance, message: message);
}

public void kill () {
if (instance == null) {
warning ("No instance to kill");
return;
}

try {
var app_id = app_info.get_id ().replace (".desktop", "");
Process.spawn_command_line_async ("flatpak kill %s".printf (app_id));
} catch (Error e) {
warning ("Failed to kill instance: %s", e.message);
}
}
}
78 changes: 78 additions & 0 deletions src/AppSystem/Background/BackgroundAppRow.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* SPDX-License-Identifier: GPL-3.0
* SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io)
*
* Authored by: Leonhard Kargl <leo.kargl@proton.me>
*/

public class Dock.BackgroundAppRow : Gtk.ListBoxRow {
public BackgroundApp app { get; construct; }

public BackgroundAppRow (BackgroundApp app) {
Object (app: app);
}

construct {
var icon = new Gtk.Image.from_gicon (app.app_info.get_icon ()) {
icon_size = LARGE
};

var name = new Gtk.Label (app.app_info.get_display_name ()) {
xalign = 0,
hexpand = true
};

var message = new Gtk.Label (app.message) {
xalign = 0,
hexpand = true
};
message.add_css_class (Granite.STYLE_CLASS_DIM_LABEL);
message.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL);

var button = new Gtk.Button.from_icon_name ("window-close-symbolic") {
valign = CENTER,
tooltip_text = _("Quit"),
};
button.add_css_class ("close-button");
button.add_css_class (Granite.STYLE_CLASS_CIRCULAR);
button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);

var spinner = new Gtk.Spinner () {
spinning = true
};

var button_stack = new Gtk.Stack () {
transition_type = CROSSFADE
};
button_stack.add_named (button, "button");
button_stack.add_named (spinner, "spinner");

var grid = new Gtk.Grid () {
column_spacing = 9,
row_spacing = 3
};
grid.attach (icon, 0, 0, 1, 2);

if (app.message != null) {
grid.attach (name, 1, 0);
grid.attach (message, 1, 1);
} else {
grid.attach (name, 1, 0, 1, 2);
}

grid.attach (button_stack, 2, 0, 1, 2);

child = grid;

button.clicked.connect (() => {
button_stack.set_visible_child_name ("spinner");
app.kill ();

Timeout.add_seconds (5, () => {
// Assume killing failed
button_stack.set_visible_child_name ("button");
return Source.REMOVE;
});
});
}
}
Loading