From 01f699f30cabb9e71bd8eb15aa25fbb864abc651 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Tue, 2 Jan 2024 18:55:14 +0100 Subject: [PATCH] Allow focusing window via DesktopIntegration --- src/DesktopIntegration.vala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala index 2b701b902..ee27c0138 100644 --- a/src/DesktopIntegration.vala +++ b/src/DesktopIntegration.vala @@ -102,4 +102,15 @@ public class Gala.DesktopIntegration : GLib.Object { return (owned) returned_windows; } + + public void focus_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.activate (wm.get_display ().get_current_time ()); + } + } + } + } }