From b3b8ca4ad294a8a9dd950ebb1beb072e1ac4cd78 Mon Sep 17 00:00:00 2001 From: moises2657 Date: Wed, 1 Jan 2025 23:52:26 +0000 Subject: [PATCH 1/4] DesktopIntegration: new method to close window used by dock --- src/DesktopIntegration.vala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala index 83a03642e..2d056b12b 100644 --- a/src/DesktopIntegration.vala +++ b/src/DesktopIntegration.vala @@ -183,4 +183,28 @@ public class Gala.DesktopIntegration : GLib.Object { wm.window_overview.open (hints); } + + public void close_window (uint64 uid) throws GLib.DBusError, GLib.IOError { + + var apps = Gala.AppSystem.get_default().get_running_apps(); + + foreach (unowned var app in apps) { + + foreach (weak Meta.Window window in app.get_windows()) { + + if (window.get_id() == uid) { + + window.delete(0); + + return; + + } + + } + + } + + throw new GLib.IOError.NOT_FOUND("Window not found"); + + } } From b0a896741c9b6a59a7f1557c553f3ae00f05895d Mon Sep 17 00:00:00 2001 From: moises2657 Date: Thu, 2 Jan 2025 10:55:59 -0600 Subject: [PATCH 2/4] fix spaces and timestamp --- src/DesktopIntegration.vala | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala index 2d056b12b..54dfa808e 100644 --- a/src/DesktopIntegration.vala +++ b/src/DesktopIntegration.vala @@ -185,26 +185,15 @@ public class Gala.DesktopIntegration : GLib.Object { } public void close_window (uint64 uid) throws GLib.DBusError, GLib.IOError { - var apps = Gala.AppSystem.get_default().get_running_apps(); - foreach (unowned var app in apps) { - foreach (weak Meta.Window window in app.get_windows()) { - if (window.get_id() == uid) { - - window.delete(0); - + window.delete(Meta.CURRENT_TIME); return; - } - } - } - throw new GLib.IOError.NOT_FOUND("Window not found"); - } } From bfaabd230d8cfd321e91e911622a0b2db19e2fee Mon Sep 17 00:00:00 2001 From: moises2657 Date: Thu, 2 Jan 2025 11:32:24 -0600 Subject: [PATCH 3/4] lint fix --- src/DesktopIntegration.vala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala index 54dfa808e..d764e3a99 100644 --- a/src/DesktopIntegration.vala +++ b/src/DesktopIntegration.vala @@ -185,15 +185,15 @@ public class Gala.DesktopIntegration : GLib.Object { } public void close_window (uint64 uid) throws GLib.DBusError, GLib.IOError { - var apps = Gala.AppSystem.get_default().get_running_apps(); + var apps = Gala.AppSystem.get_default ().get_running_apps (); foreach (unowned var app in apps) { - foreach (weak Meta.Window window in app.get_windows()) { - if (window.get_id() == uid) { - window.delete(Meta.CURRENT_TIME); + foreach (weak Meta.Window window in app.get_windows ()) { + if (window.get_id () == uid) { + window.delete (Meta.CURRENT_TIME); return; } } } - throw new GLib.IOError.NOT_FOUND("Window not found"); + throw new GLib.IOError.NOT_FOUND ("Window not found"); } } From 6116be20139ac267e62a7d891459b8abe7ee6f51 Mon Sep 17 00:00:00 2001 From: Leo Date: Thu, 13 Mar 2025 15:42:19 +0300 Subject: [PATCH 4/4] Update src/DesktopIntegration.vala --- src/DesktopIntegration.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala index 333aa9a9c..793290965 100644 --- a/src/DesktopIntegration.vala +++ b/src/DesktopIntegration.vala @@ -255,6 +255,7 @@ public class Gala.DesktopIntegration : GLib.Object { } } } + throw new GLib.IOError.NOT_FOUND ("Window not found"); } }