Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
1cfd418
WIP: POF workspace switcher
lenemter Feb 12, 2025
bbd8aed
Fix bugs
lenemter Feb 12, 2025
95e19dc
Add support for switching workspaces
lenemter Feb 12, 2025
e34fc23
Use existing DesktopIntegration API
lenemter Feb 13, 2025
aca71f9
Fix crash. Make WorkspaceSystem handle the workspace indexes
lenemter Feb 13, 2025
28c1149
Introduce WindowSystem
lenemter Feb 13, 2025
a42d660
Fix edge cases
lenemter Feb 13, 2025
116acd5
Restructure the project
lenemter Feb 13, 2025
2326695
LauncherManager -> ItemManager
lenemter Feb 13, 2025
a0a3c29
Add support for custom dynamic workspace styling
lenemter Feb 13, 2025
0ef83b8
IconGroup: respect icon-size setting
lenemter Feb 13, 2025
c0fca29
Prepare support for active workspace indicator
lenemter Feb 13, 2025
eaf00ec
Don't reload application windows when switching workspace
lenemter Feb 13, 2025
072bfbd
Add active workspace indicator
lenemter Feb 13, 2025
2d467ff
A
lenemter Feb 13, 2025
fdd29b1
Fix lint
lenemter Feb 13, 2025
982b778
Add new line
lenemter Feb 13, 2025
1866d64
CSS: add workspace switcher styles (#364)
danirabbit Feb 13, 2025
0b7d384
Merge branch 'main' into lenemter/workspace-switcher-pof
lenemter Feb 13, 2025
72597c9
Fix crash
lenemter Feb 13, 2025
cf1e40d
Improve high contrast styles (#365)
danirabbit Feb 13, 2025
67d7c46
Add separate button for new workspace
lenemter Feb 13, 2025
89bacb7
DynamicWorkspaceItem: scale icon with dock icon size (#369)
danirabbit Feb 13, 2025
c6177c3
Update icon sizes in IconGroup for better scaling (#368)
alainm23 Feb 14, 2025
ad28f33
Dynamically compute grid spacing
lenemter Feb 14, 2025
6d0d7e7
Fix alignment
lenemter Feb 14, 2025
8619d9c
Fix crash
lenemter Feb 14, 2025
1203631
Merge branch 'main' into lenemter/workspace-switcher-pof
lenemter Feb 14, 2025
c740899
Fix merge and update POTFILES
lenemter Feb 14, 2025
4599581
Add a nice pop up animation
lenemter Feb 14, 2025
d7351d1
Remove TODO
lenemter Feb 14, 2025
1ee32c0
Introduce DockSettings
lenemter Feb 14, 2025
04ddbd8
Move launchers here as well
lenemter Feb 14, 2025
712dceb
Fix lint
lenemter Feb 14, 2025
d26c39b
Create base class 'DockItem'
lenemter Feb 14, 2025
5071d4c
Remove DockSettings
lenemter Feb 14, 2025
19614cd
Remove extra new line
lenemter Feb 14, 2025
a48b91c
Merge branch 'main' into lenemter/workspace-switcher-pof
lenemter Feb 14, 2025
63da719
AppSystem: Revert changes to active workspace handling
lenemter Feb 15, 2025
b05dd1f
Reduce diff
lenemter Feb 15, 2025
1d2adac
Add default icon
lenemter Feb 15, 2025
08ed668
Make DynamicWorkspaceIcon a subclass of DockItem
lenemter Feb 15, 2025
05869b7
DockItem -> BaseItem
lenemter Feb 15, 2025
82d87df
Merge branch 'main' into lenemter/workspace-switcher-pof
lenemter Feb 15, 2025
fdff8a9
Don't query active workspace on windows update
lenemter Feb 15, 2025
c383eb1
Remove setup_item_removed
lenemter Feb 15, 2025
f2f0e1a
Add pop up animation for dynamic workspace
lenemter Feb 15, 2025
52104d0
Merge branch 'main' into lenemter/workspace-switcher-pof
lenemter Feb 16, 2025
204b1da
remove_item_finish -> remove_finish
lenemter Feb 16, 2025
247c872
A
lenemter Feb 16, 2025
1c60d30
Better track of removed workspaces
lenemter Feb 16, 2025
f0707b0
Revert "Better track of removed workspaces"
lenemter Feb 17, 2025
b5e81f5
Fix removing workspaces
lenemter Feb 17, 2025
12d63b5
Fix warnings
lenemter Feb 17, 2025
8399ecb
Remove duplicate files from meson
lenemter Feb 17, 2025
7da3132
Sort files
lenemter Feb 17, 2025
d4e4198
Merge branch 'main' into lenemter/workspace-switcher-pof
lenemter Feb 17, 2025
30f6eeb
Simplify reposition_items
lenemter Feb 24, 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
16 changes: 16 additions & 0 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ launcher progressbar progress {
min-width: 0;
}

icongroup {
padding: 6px;
padding-bottom: 0px;
}

icongroup grid {
background-color: #23232380;
border-radius: 6px;
border: 1px solid #232323c8;
}

icongroup.dynamic grid {
background-color: #17171780;
border: 1px solid #171717c8;
}

.running-indicator {
color: @selected_fg_color;
-gtk-icon-size: 9px;
Expand Down
53 changes: 21 additions & 32 deletions src/App.vala → src/AppSystem/App.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,13 @@ public class Dock.App : Object {
public double progress { get; set; default = 0; }
public bool prefers_nondefault_gpu { get; private set; default = false; }
public bool running { get { return windows.size > 0; } }
public bool running_on_active_workspace {
get {
foreach (var win in windows) {
if (win.on_active_workspace) {
return true;
}
}

return false;
}
}
public bool running_on_active_workspace { get; private set; }
public bool launching { get; private set; default = false; }

public SimpleActionGroup action_group { get; construct; }
public Menu menu_model { get; construct; }

public Gee.List<AppWindow> windows { get; private owned set; } //Ordered by stacking order with topmost at 0
public Gee.List<Window> windows { get; private owned set; } //Ordered by stacking order with topmost at 0

private static Dock.SwitcherooControl switcheroo_control;

Expand All @@ -63,7 +53,7 @@ public class Dock.App : Object {
}

construct {
windows = new Gee.LinkedList<AppWindow> ();
windows = new Gee.LinkedList<Window> ();

action_group = new SimpleActionGroup ();

Expand Down Expand Up @@ -119,7 +109,7 @@ public class Dock.App : Object {
notify["pinned"].connect (() => {
pinned_action.set_state (pinned);
check_remove ();
LauncherManager.get_default ().sync_pinned ();
ItemManager.get_default ().sync_pinned ();
});
}

Expand All @@ -138,9 +128,9 @@ public class Dock.App : Object {
} else if (windows.size == 0) {
app_info.launch (null, context);
} else if (windows.size == 1) {
AppSystem.get_default ().desktop_integration.focus_window.begin (windows.first ().uid);
} else if (AppSystem.get_default ().desktop_integration != null) {
AppSystem.get_default ().desktop_integration.show_windows_for.begin (app_info.get_id ());
WindowSystem.get_default ().desktop_integration.focus_window.begin (windows.first ().uid);
} else if (WindowSystem.get_default ().desktop_integration != null) {
WindowSystem.get_default ().desktop_integration.show_windows_for.begin (app_info.get_id ());
}
} catch (Error e) {
critical (e.message);
Expand Down Expand Up @@ -184,15 +174,15 @@ public class Dock.App : Object {
}
}

public void update_windows (Gee.List<AppWindow>? new_windows) {
public void update_windows (Gee.List<Window>? new_windows) {
if (new_windows == null) {
windows = new Gee.LinkedList<AppWindow> ();
windows = new Gee.LinkedList<Window> ();
} else {
windows = new_windows;
}

notify_property ("running-on-active-workspace");
notify_property ("running");
update_active_workspace ();

if (launching && running) {
launching = false;
Expand All @@ -201,16 +191,15 @@ public class Dock.App : Object {
check_remove ();
}

public AppWindow? find_window (uint64 window_uid) {
var found_win = windows.first_match ((win) => {
return win.uid == window_uid;
});

if (found_win != null) {
return found_win;
} else {
return null;
public void update_active_workspace () {
var new_running_on_active_workspace = false;
foreach (var window in windows) {
if (window.workspace_index == WindowSystem.get_default ().active_workspace) {
new_running_on_active_workspace = true;
break;
}
}
running_on_active_workspace = new_running_on_active_workspace;
}

public void perform_unity_update (VariantIter prop_iter) {
Expand Down Expand Up @@ -241,7 +230,7 @@ public class Dock.App : Object {
progress = 0;
}

private AppWindow[] current_windows;
private Window[] current_windows;
private uint current_index;
private uint timer_id = 0;
private bool should_wait = false;
Expand All @@ -264,7 +253,7 @@ public class Dock.App : Object {
return;
}

AppSystem.get_default ().desktop_integration.focus_window.begin (current_windows[current_index].uid);
WindowSystem.get_default ().desktop_integration.focus_window.begin (current_windows[current_index].uid);

// Throttle the scroll for performance and better visibility of the windows
Timeout.add (250, () => {
Expand All @@ -282,7 +271,7 @@ public class Dock.App : Object {
yield AppSystem.get_default ().sync_windows (); // Get the current stacking order
current_index = windows.size > 1 && windows.first ().has_focus ? 1 : 0;
current_windows = {};
foreach (AppWindow window in windows) {
foreach (var window in windows) {
current_windows += window;
}
}
Expand Down
57 changes: 19 additions & 38 deletions src/AppSystem.vala → src/AppSystem/AppSystem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class Dock.AppSystem : Object, UnityClient {

public signal void app_added (App app);

public DesktopIntegration? desktop_integration { get; private set; }

private GLib.HashTable<unowned string, App> id_to_app;

private AppSystem () { }
Expand All @@ -37,19 +35,10 @@ public class Dock.AppSystem : Object, UnityClient {
add_app (app_info, true);
}

try {
desktop_integration = yield GLib.Bus.get_proxy<Dock.DesktopIntegration> (
SESSION,
"org.pantheon.gala",
"/org/pantheon/gala/DesktopInterface"
);

yield sync_windows ();
yield sync_windows ();

desktop_integration.windows_changed.connect (sync_windows);
} catch (Error e) {
critical ("Failed to get desktop integration: %s", e.message);
}
WindowSystem.get_default ().notify["windows"].connect (sync_windows);
WindowSystem.get_default ().notify["active-workspace"].connect (sync_active_workspace);
}

private App add_app (DesktopAppInfo app_info, bool pinned) {
Expand All @@ -60,52 +49,44 @@ public class Dock.AppSystem : Object, UnityClient {
return app;
}

public async void sync_windows () requires (desktop_integration != null) {
DesktopIntegration.Window[] windows;
try {
windows = yield desktop_integration.get_windows ();
} catch (Error e) {
critical (e.message);
return;
}
public async void sync_windows () {
var windows = WindowSystem.get_default ().windows;

var app_window_list = new Gee.HashMap<App, Gee.List<AppWindow>> ();
foreach (unowned var window in windows) {
unowned var app_id = window.properties["app-id"].get_string ();
App? app = id_to_app[app_id];
var app_window_list = new Gee.HashMap<App, Gee.List<Window>> ();
foreach (var window in windows) {
App? app = id_to_app[window.app_id];
if (app == null) {
var app_info = new GLib.DesktopAppInfo (app_id);
var app_info = new GLib.DesktopAppInfo (window.app_id);
if (app_info == null) {
continue;
}

app = add_app (app_info, false);
}

AppWindow? app_window = app.find_window (window.uid);
if (app_window == null) {
app_window = new AppWindow (window.uid);
}

app_window.update_properties (window.properties);

var window_list = app_window_list.get (app);
if (window_list == null) {
var new_window_list = new Gee.LinkedList<AppWindow> ();
new_window_list.add (app_window);
var new_window_list = new Gee.LinkedList<Window> ();
new_window_list.add (window);
app_window_list.set (app, new_window_list);
} else {
window_list.add (app_window);
window_list.add (window);
}
}

foreach (var app in id_to_app.get_values ()) {
Gee.List<AppWindow>? window_list = null;
Gee.List<Window>? window_list = null;
app_window_list.unset (app, out window_list);
app.update_windows (window_list);
}
}

public async void sync_active_workspace () {
foreach (var app in id_to_app.get_values ()) {
app.update_active_workspace ();
}
}

public void add_app_for_id (string app_id) {
if (app_id in id_to_app) {
id_to_app[app_id].pinned = true;
Expand Down
8 changes: 4 additions & 4 deletions src/Launcher.vala → src/AppSystem/Launcher.vala
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public class Dock.Launcher : Gtk.Box {
orientation = VERTICAL;
tooltip_text = app.app_info.get_display_name ();

var launcher_manager = LauncherManager.get_default ();
var launcher_manager = ItemManager.get_default ();

insert_action_group (ACTION_GROUP_PREFIX, app.action_group);

Expand Down Expand Up @@ -271,15 +271,15 @@ public class Dock.Launcher : Gtk.Box {
add_controller (drop_target_file);

drop_target_file.enter.connect ((x, y) => {
var _launcher_manager = LauncherManager.get_default ();
var _launcher_manager = ItemManager.get_default ();
if (_launcher_manager.added_launcher != null) {
calculate_dnd_move (_launcher_manager.added_launcher, x, y);
}
return COPY;
});

drop_target_file.drop.connect (() => {
var _launcher_manager = LauncherManager.get_default ();
var _launcher_manager = ItemManager.get_default ();
if (_launcher_manager.added_launcher != null) {
_launcher_manager.added_launcher.moving = false;
_launcher_manager.added_launcher = null;
Expand Down Expand Up @@ -476,7 +476,7 @@ public class Dock.Launcher : Gtk.Box {
* @param y pointer y position
*/
private void calculate_dnd_move (Launcher source, double x, double y) {
var launcher_manager = LauncherManager.get_default ();
var launcher_manager = ItemManager.get_default ();

int target_index = launcher_manager.get_index_for_launcher (this);
int source_index = launcher_manager.get_index_for_launcher (source);
Expand Down
File renamed without changes.
26 changes: 0 additions & 26 deletions src/AppWindow.vala

This file was deleted.

2 changes: 1 addition & 1 deletion src/DBus/ShellKeyGrabber.vala
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public interface ShellKeyGrabber : GLib.Object {
return;
}

Dock.LauncherManager.get_default ().launch (saved_action_ids[action]);
Dock.ItemManager.get_default ().launch (saved_action_ids[action]);
}

private static void ungrab_keybindings () requires (instance != null) {
Expand Down
Loading