From f23e2fc2a5a6f53eb367a2440ce62cc3a5401846 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Sat, 20 Jan 2024 23:31:04 +0100 Subject: [PATCH] Integrate with gala window spread --- src/DesktopIntegration.vala | 1 + src/Launcher.vala | 4 +++- src/LauncherManager.vala | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala index 2180163d..2407e856 100644 --- a/src/DesktopIntegration.vala +++ b/src/DesktopIntegration.vala @@ -23,4 +23,5 @@ public interface Dock.DesktopIntegration : GLib.Object { public abstract RunningApplication[] get_running_applications () throws GLib.DBusError, GLib.IOError; public abstract Window[] get_windows () throws GLib.DBusError, GLib.IOError; + public abstract void show_windows_for (string app_id) throws GLib.DBusError, GLib.IOError; } diff --git a/src/Launcher.vala b/src/Launcher.vala index 1f6fcad1..2dfe4bfc 100644 --- a/src/Launcher.vala +++ b/src/Launcher.vala @@ -239,8 +239,10 @@ public class Dock.Launcher : Gtk.Button { if (action != null) { app_info.launch_action (action, context); - } else { + } else if (windows.length () <= 1) { app_info.launch (null, context); + } else if (LauncherManager.get_default ().desktop_integration != null) { + LauncherManager.get_default ().desktop_integration.show_windows_for (app_info.get_id ()); } } catch (Error e) { critical (e.message); diff --git a/src/LauncherManager.vala b/src/LauncherManager.vala index 5302c8df..d641ec71 100644 --- a/src/LauncherManager.vala +++ b/src/LauncherManager.vala @@ -12,9 +12,9 @@ } public Launcher? added_launcher { get; set; default = null; } + public Dock.DesktopIntegration? desktop_integration { get; private set; } private List launchers; //Only used to keep track of launcher indices - private Dock.DesktopIntegration desktop_integration; private GLib.HashTable app_to_launcher; static construct {