Skip to content
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
35c74f0
WIP: POF dock workspace switcher
lenemter Feb 12, 2025
a18c865
Add activate_workspace method
lenemter Feb 12, 2025
0a08fe5
Use existing DesktopIntegration API
lenemter Feb 13, 2025
1b7635c
Fix bug when rearranging window in multitasking view
lenemter Feb 13, 2025
b26a804
Add get_n_workspaces
lenemter Feb 13, 2025
7551c9d
Provide API for listening to workspace switch
lenemter Feb 13, 2025
19be18e
Throw error, update copyright year, fix warning
lenemter Feb 13, 2025
84963fd
Beep when activate_workspace does nothing
lenemter Feb 14, 2025
a4fda74
Merge branch 'main' into lenemter/dock-workspace-switcher-pof
lenemter Feb 14, 2025
0669c0a
Remove dock's changes to on-active-workspace property
lenemter Feb 15, 2025
34ca30c
Merge branch 'main' into lenemter/dock-workspace-switcher-pof
lenemter Feb 15, 2025
d927490
Add workspace_removed signal
lenemter Feb 16, 2025
1a00e92
Add n_workspaces_changed
lenemter Feb 16, 2025
a65c007
Revert "Add n_workspaces_changed"
lenemter Feb 17, 2025
e425989
Revert "Add workspace_removed signal"
lenemter Feb 17, 2025
7d1e194
FIx removing workspaces
lenemter Feb 17, 2025
14e3432
Merge branch 'main' into lenemter/dock-workspace-switcher-pof
lenemter Feb 17, 2025
f589b45
Add 'time-appeared-on-workspace' property
lenemter Feb 18, 2025
a355282
Merge branch 'main' into leneemter/sort-windows
lenemter Mar 1, 2025
3a2317b
Add 'time-appeared-on-workspace' property
lenemter Feb 18, 2025
9cb861e
Merge branch 'leneemter/sort-windows' of https://github.com/elementar…
lenemter Mar 1, 2025
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
21 changes: 19 additions & 2 deletions src/DesktopIntegration.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ public class Gala.DesktopIntegration : GLib.Object {
GLib.HashTable<unowned string, Variant> properties;
}

private unowned WindowManagerGala wm;
public uint version { get; default = 1; }
public signal void running_applications_changed ();
public signal void windows_changed ();
public signal void active_workspace_changed ();
public signal void workspace_removed (int index);
private unowned WindowManagerGala wm;
private GLib.HashTable<Meta.Window, int64?> time_appeared_on_workspace;

public DesktopIntegration (WindowManagerGala wm) {
this.wm = wm;
time_appeared_on_workspace = new GLib.HashTable<Meta.Window, int64?> (GLib.direct_hash, GLib.direct_equal);

wm.window_tracker.windows_changed.connect (() => windows_changed ());

unowned var display = wm.get_display ();
Expand All @@ -42,11 +45,21 @@ public class Gala.DesktopIntegration : GLib.Object {

// TODO: figure out if there's a better way to handle ws rearrangement
display.window_created.connect ((window) => {
time_appeared_on_workspace[window] = GLib.get_real_time ();

window.workspace_changed.connect ((_window) => {
time_appeared_on_workspace[_window] = GLib.get_real_time ();
windows_changed ();
});

window.unmanaging.connect ((_window) => {
time_appeared_on_workspace.remove (_window);
});

window.workspace_changed.connect (() => windows_changed ());
});
}

public RunningApplication[] get_running_applications () throws GLib.DBusError, GLib.IOError {
RunningApplication[] returned_apps = {};
var apps = Gala.AppSystem.get_default ().get_running_apps ();
foreach (unowned var app in apps) {
Expand Down Expand Up @@ -117,6 +130,10 @@ public class Gala.DesktopIntegration : GLib.Object {
properties.insert ("sandboxed-app-id", new GLib.Variant.string (sandboxed_app_id));
}

if (window in time_appeared_on_workspace && time_appeared_on_workspace[window] != null) {
properties.insert ("time-appeared-on-workspace", new GLib.Variant.int64 (time_appeared_on_workspace[window]));
}

returned_windows += Window () {
uid = window.get_id (),
properties = properties
Expand Down
Loading