Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions src/WindowSystem/Window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Dock.Window : GLib.Object {
public string app_id { get; private set; default = ""; }
public bool has_focus { get; private set; default = false; }
public int workspace_index { get; private set; default = 0; }
public int64 time_appeared_on_workspace { get; private set; default = 0; }
public bool on_active_workspace { get; private set; default = false; }

public GLib.Icon icon { get; private set; default = new GLib.ThemedIcon ("application-default-icon"); }
Expand All @@ -31,6 +32,10 @@ public class Dock.Window : GLib.Object {
workspace_index = (int) properties["workspace-index"];
}

if ("time-appeared-on-workspace" in properties) {
time_appeared_on_workspace = (int64) properties["time-appeared-on-workspace"];
}

if ("on-active-workspace" in properties) {
on_active_workspace = (bool) properties["on-active-workspace"];
}
Expand Down
6 changes: 6 additions & 0 deletions src/WorkspaceSystem/WorkspaceSystem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,18 @@ public class Dock.WorkspaceSystem : Object {
workspace = add_workspace ();
}

workspace_window_list[i].sort (compare_func);

workspace.windows = workspace_window_list[i];
workspace.index = i;
workspace.update_active_workspace ();
}
}

private int compare_func (Window a, Window b) {
return (int) (a.time_appeared_on_workspace - b.time_appeared_on_workspace);
}

private async void sync_active_workspace () {
foreach (var workspace in workspaces) {
workspace.update_active_workspace ();
Expand Down