Skip to content

Commit

Permalink
workspace-applet: Make add workspace button react to capabilities
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Maddock <maddock.evan@vivaldi.net>
  • Loading branch information
EbonJaeger committed Feb 12, 2025
1 parent f7e98fc commit 6f9c937
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/panel/applets/workspaces/WorkspacesApplet.vala
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ namespace Workspaces {
add_button.get_style_context().add_class("workspace-add-button");
add_button.valign = Gtk.Align.CENTER;
add_button.halign = Gtk.Align.CENTER;

if (!(libxfce4windowing.WorkspaceGroupCapabilities.CREATE_WORKSPACE in workspace_group.get_capabilities())) {
add_button.sensitive = false;
add_button.set_tooltip_text(_("Not able to create new workspaces"));
} else {
add_button.set_tooltip_text(_("Create a new workspace"));
}

add_button_revealer.add(add_button);
main_layout.pack_start(add_button_revealer, false, false, 0);

Expand Down Expand Up @@ -210,6 +218,18 @@ namespace Workspaces {

return Gdk.EVENT_STOP;
});

workspace_group.capabilities_changed.connect((changed_mask, new_capabilities) => {
if (libxfce4windowing.WorkspaceGroupCapabilities.CREATE_WORKSPACE in changed_mask) {
if (!(libxfce4windowing.WorkspaceGroupCapabilities.CREATE_WORKSPACE in new_capabilities)) {
add_button.sensitive = false;
add_button.set_tooltip_text(_("Not able to create new workspaces"));
} else {
add_button.sensitive = true;
add_button.set_tooltip_text(_("Create a new workspace"));
}
}
});
}

private void on_settings_change(string key) {
Expand Down

0 comments on commit 6f9c937

Please sign in to comment.