Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cosmic/workspaces module #3481

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Consolatis
Copy link

cosmic-workspace-unstable-v1 is a vendored version of the ext-workspace protocol and can be used without hiding the implementation behind feature flags. The only difference of version 1 in comparison to the ext-workspaces protocol implemented in Waybar is an added capability system.


This is essentially a straight up copy of wlr/workspaces with s/zext_workspace/zcosmic_workspace/ and additional no-op listeners for the capability event. It can be tested against labwc/labwc#2030 and should also work with the cosmic compositor itself but I never tested this. My hope is that other compositors and panels will implement support for version 1 of the protocol as well so it doesn't take another 3 years for users to be able to activate workspaces via panel.

Related PRs:

Some diffs between the two protocols
--- protocol/ext-workspace-unstable-v1.xml	2022-06-06 12:54:51.225404838 +0200
+++ protocol/cosmic-workspace-unstable-v1.xml	2024-07-27 21:01:02.290416622 +0200
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<protocol name="ext_workspace_unstable_v1">
+<protocol name="cosmic_workspace_unstable_v1">
   <copyright>
     Copyright © 2019 Christopher Billington
     Copyright © 2020 Ilia Bozhinov
+    Copyright © 2022 Victoria Brekenfeld
 
     Permission to use, copy, modify, distribute, and sell this
     software and its documentation for any purpose is hereby granted
@@ -26,7 +27,7 @@
     THIS SOFTWARE.
   </copyright>
 
-  <interface name="zext_workspace_manager_v1" version="1">
+  <interface name="zcosmic_workspace_manager_v1" version="1">
     <description summary="list and control workspaces">
       Workspaces, also called virtual desktops, are groups of surfaces. A
       compositor with a concept of workspaces may only show some such groups of
@@ -45,7 +46,7 @@
       docks by providing them with a list of workspaces and their properties,
       and allowing them to activate and deactivate workspaces.
 
-      After a client binds the zext_workspace_manager_v1, each workspace will be
+      After a client binds the zcosmic_workspace_manager_v1, each workspace will be
       sent via the workspace event.
     </description>
 
@@ -55,9 +56,9 @@
 
         All initial details of the workspace group (workspaces, outputs) will be
         sent immediately after this event via the corresponding events in
-        zext_workspace_group_handle_v1.
+        zcosmic_workspace_group_handle_v1.
       </description>
-      <arg name="workspace_group" type="new_id" interface="zext_workspace_group_handle_v1"/>
+      <arg name="workspace_group" type="new_id" interface="zcosmic_workspace_group_handle_v1"/>
     </event>
 
     <request name="commit">
@@ -68,7 +69,7 @@
 
         This allows changes to the workspace properties to be seen as atomic,
         even if they happen via multiple events, and even if they involve
-        multiple zext_workspace_handle_v1 objects, for example, deactivating one
+        multiple zcosmic_workspace_handle_v1 objects, for example, deactivating one
         workspace and activating another.
       </description>
     </request>
@@ -78,11 +79,12 @@
         This event is sent after all changes in all workspace groups have been
         sent.
 
-        This allows changes to one or more zext_workspace_group_handle_v1
-        properties to be seen as atomic, even if they happen via multiple
-        events. In particular, an output moving from one workspace group to
+        This allows changes to one or more zcosmic_workspace_group_handle_v1
+        properties and zcosmic_workspace_handle_v1 properties to be seen as atomic,
+        even if they happen via multiple events.
+        In particular, an output moving from one workspace group to
         another sends an output_enter event and an output_leave event to the two
-        zext_workspace_group_handle_v1 objects in question. The compositor sends
+        zcosmic_workspace_group_handle_v1 objects in question. The compositor sends
         the done event only after updating the output information in both
         workspace groups.
       </description>
@@ -91,7 +93,7 @@
     <event name="finished">
       <description summary="the compositor has finished with the workspace_manager">
         This event indicates that the compositor is done sending events to the
-        zext_workspace_manager_v1. The server will destroy the object
+        zcosmic_workspace_manager_v1. The server will destroy the object
         immediately after sending this request, so it will become invalid and
         the client should free any resources associated with it.
       </description>
@@ -108,9 +110,9 @@
     </request>
   </interface>
 
-  <interface name="zext_workspace_group_handle_v1" version="1">
+  <interface name="zcosmic_workspace_group_handle_v1" version="1">
     <description summary="a workspace group assigned to a set of outputs">
-      A zext_workspace_group_handle_v1 object represents a a workspace group
+      A zcosmic_workspace_group_handle_v1 object represents a a workspace group
       that is assigned a set of outputs and contains a number of workspaces.
 
       The set of outputs assigned to the workspace group is conveyed to the client via
@@ -123,6 +125,32 @@
       outputs.
     </description>
 
+    <enum name="zcosmic_workspace_group_capabilities_v1">
+      <entry name="create_workspace" value="1" summary="create_workspace request is available"/>
+    </enum>
+
+    <event name="capabilities">
+      <description summary="compositor capabilities">
+        This event advertises the capabilities supported by the compositor. If
+        a capability isn't supported, clients should hide or disable the UI
+        elements that expose this functionality. For instance, if the
+        compositor doesn't advertise support for creating workspaces, a button
+        triggering the create_workspace request should not be displayed.
+
+        The compositor will ignore requests it doesn't support. For instance,
+        a compositor which doesn't advertise support for creating workspaces will ignore
+        create_workspace requests.
+
+        Compositors must send this event once after creation of an
+        zcosmic_workspace_group_handle_v1 . When the capabilities change, compositors
+        must send this event again.
+
+        The capabilities are sent as an array of 32-bit unsigned integers in
+        native endianness.
+      </description>
+      <arg name="capabilities" type="array" summary="array of 32-bit capabilities"/>
+    </event>
+
     <event name="output_enter">
       <description summary="output assigned to workspace group">
         This event is emitted whenever an output is assigned to the workspace
@@ -142,19 +170,21 @@
     <event name="workspace">
       <description summary="workspace added to workspace group">
         This event is emitted whenever a new workspace has been created.
+        A workspace can only be a member of a single workspace group and cannot
+        be re-assigned.
 
         All initial details of the workspace (name, coordinates, state) will
         be sent immediately after this event via the corresponding events in
-        zext_workspace_handle_v1.
+        zcosmic_workspace_handle_v1.
       </description>
-      <arg name="workspace" type="new_id" interface="zext_workspace_handle_v1"/>
+      <arg name="workspace" type="new_id" interface="zcosmic_workspace_handle_v1"/>
     </event>
 
     <event name="remove">
       <description summary="this workspace group has been destroyed">
-        This event means the zext_workspace_group_handle_v1 has been destroyed.
+        This event means the zcosmic_workspace_group_handle_v1 has been destroyed.
         It is guaranteed there won't be any more events for this
-        zext_workspace_group_handle_v1. The zext_workspace_group_handle_v1 becomes
+        zcosmic_workspace_group_handle_v1. The zext_workspace_group_handle_v1 becomes
         inert so any requests will be ignored except the destroy request.
 
         The compositor must remove all workspaces belonging to a workspace group
@@ -173,8 +203,8 @@
     </request>
 
     <request name="destroy" type="destructor">
-      <description summary="destroy the zext_workspace_handle_v1 object">
-        Destroys the zext_workspace_handle_v1 object.
+      <description summary="destroy the zcosmic_workspace_group_handle_v1 object">
+        Destroys the zcosmic_workspace_group_handle_v1 object.
 
         This request should be called either when the client does not want to
         use the workspace object any more or after the remove event to finalize
@@ -183,9 +213,9 @@
     </request>
   </interface>
 
-  <interface name="zext_workspace_handle_v1" version="1">
+  <interface name="zcosmic_workspace_handle_v1" version="1">
     <description summary="a workspace handing a group of surfaces">
-      A zext_workspace_handle_v1 object represents a a workspace that handles a
+      A zcosmic_workspace_handle_v1 object represents a a workspace that handles a
       group of surfaces.
 
       Each workspace has a name, conveyed to the client with the name event; a
@@ -202,7 +232,7 @@
 
     <event name="name">
       <description summary="workspace name changed">
-        This event is emitted immediately after the zext_workspace_handle_v1 is
+        This event is emitted immediately after the zcosmic_workspace_handle_v1 is
         created and whenever the name of the workspace changes.
       </description>
       <arg name="name" type="string"/>
@@ -212,7 +242,7 @@
       <description summary="workspace coordinates changed">
         This event is used to organize workspaces into an N-dimensional grid
         within a workspace group, and if supported, is emitted immediately after
-        the zext_workspace_handle_v1 is created and whenever the coordinates of
+        the zcosmic_workspace_handle_v1 is created and whenever the coordinates of
         the workspace change. Compositors may not send this event if they do not
         conceptually arrange workspaces in this way. If compositors simply
         number workspaces, without any geometric interpretation, they may send
@@ -234,7 +264,7 @@
 
     <event name="state">
       <description summary="the state of the workspace changed">
-        This event is emitted immediately after the zext_workspace_handle_v1 is
+        This event is emitted immediately after the zcosmic_workspace_handle_v1 is
         created and each time the workspace state changes, either because of a
         compositor action or because of a request in this protocol.
       </description>
@@ -257,18 +287,46 @@
       </entry>
     </enum>
 
+    <enum name="zcosmic_workspace_capabilities_v1">
+      <entry name="activate" value="1" summary="activate request is available"/>
+      <entry name="deactivate" value="2" summary="deactivate request is available"/>
+      <entry name="remove" value="3" summary="remove request is available"/>
+    </enum>
+
+    <event name="capabilities">
+      <description summary="compositor capabilities">
+        This event advertises the capabilities supported by the compositor. If
+        a capability isn't supported, clients should hide or disable the UI
+        elements that expose this functionality. For instance, if the
+        compositor doesn't advertise support for removing workspaces, a button
+        triggering the remove request should not be displayed.
+
+        The compositor will ignore requests it doesn't support. For instance,
+        a compositor which doesn't advertise support for remove will ignore
+        remove requests.
+
+        Compositors must send this event once after creation of an
+        zcosmic_workspace_handle_v1 . When the capabilities change, compositors
+        must send this event again.
+
+        The capabilities are sent as an array of 32-bit unsigned integers in
+        native endianness.
+      </description>
+      <arg name="capabilities" type="array" summary="array of 32-bit capabilities"/>
+    </event>
+
     <event name="remove">
       <description summary="this workspace has been destroyed">
-        This event means the zext_workspace_handle_v1 has been destroyed. It is
+        This event means the zcosmic_workspace_handle_v1 has been destroyed. It is
         guaranteed there won't be any more events for this
-        zext_workspace_handle_v1. The zext_workspace_handle_v1 becomes inert so
+        zcosmic_workspace_handle_v1. The zext_workspace_handle_v1 becomes inert so
         any requests will be ignored except the destroy request.
       </description>
     </event>
 
     <request name="destroy" type="destructor">
-      <description summary="destroy the zext_workspace_handle_v1 object">
-        Destroys the zext_workspace_handle_v1 object.
+      <description summary="destroy the zcosmic_workspace_handle_v1 object">
+        Destroys the zcosmic_workspace_handle_v1 object.
 
         This request should be called either when the client does not want to
         use the workspace object any more or after the remove event to finalize
--- src/modules/wlr/workspace_manager_binding.cpp	2022-06-06 12:54:51.245405745 +0200
+++ src/modules/cosmic/cosmic_workspace_manager_binding.cpp	2024-07-27 21:03:18.840683727 +0200
@@ -1,17 +1,17 @@
-#include "modules/wlr/workspace_manager_binding.hpp"
+#include "modules/cosmic/cosmic_workspace_manager_binding.hpp"
 
 #include <spdlog/spdlog.h>
 
 #include <cstdint>
 
 #include "client.hpp"
-#include "modules/wlr/workspace_manager.hpp"
+#include "modules/cosmic/cosmic_workspace_manager.hpp"
 
-namespace waybar::modules::wlr {
+namespace waybar::modules::cosmic {
 
 static void handle_global(void *data, wl_registry *registry, uint32_t name, const char *interface,
                           uint32_t version) {
-  if (std::strcmp(interface, zext_workspace_manager_v1_interface.name) == 0) {
+  if (std::strcmp(interface, zcosmic_workspace_manager_v1_interface.name) == 0) {
     static_cast<WorkspaceManager *>(data)->register_manager(registry, name, version);
   }
 }
@@ -33,72 +33,81 @@
 }
 
 static void workspace_manager_handle_workspace_group(
-    void *data, zext_workspace_manager_v1 *_, zext_workspace_group_handle_v1 *workspace_group) {
+    void *data, zcosmic_workspace_manager_v1 *_, zcosmic_workspace_group_handle_v1 *workspace_group) {
   static_cast<WorkspaceManager *>(data)->handle_workspace_group_create(workspace_group);
 }
 
-static void workspace_manager_handle_done(void *data, zext_workspace_manager_v1 *_) {
+static void workspace_manager_handle_done(void *data, zcosmic_workspace_manager_v1 *_) {
   static_cast<WorkspaceManager *>(data)->handle_done();
 }
 
-static void workspace_manager_handle_finished(void *data, zext_workspace_manager_v1 *_) {
+static void workspace_manager_handle_finished(void *data, zcosmic_workspace_manager_v1 *_) {
   static_cast<WorkspaceManager *>(data)->handle_finished();
 }
 
-static const zext_workspace_manager_v1_listener workspace_manager_impl = {
+static const zcosmic_workspace_manager_v1_listener workspace_manager_impl = {
     .workspace_group = workspace_manager_handle_workspace_group,
     .done = workspace_manager_handle_done,
     .finished = workspace_manager_handle_finished,
 };
 
-zext_workspace_manager_v1 *workspace_manager_bind(wl_registry *registry, uint32_t name,
+zcosmic_workspace_manager_v1 *workspace_manager_bind(wl_registry *registry, uint32_t name,
                                                   uint32_t version, void *data) {
-  auto *workspace_manager = static_cast<zext_workspace_manager_v1 *>(
-      wl_registry_bind(registry, name, &zext_workspace_manager_v1_interface, version));
+  auto *workspace_manager = static_cast<zcosmic_workspace_manager_v1 *>(
+      wl_registry_bind(registry, name, &zcosmic_workspace_manager_v1_interface, version));
 
   if (workspace_manager)
-    zext_workspace_manager_v1_add_listener(workspace_manager, &workspace_manager_impl, data);
+    zcosmic_workspace_manager_v1_add_listener(workspace_manager, &workspace_manager_impl, data);
   else
-    spdlog::error("Failed to register manager");
+    spdlog::error("Failed to register cosmic workspace manager");
 
   return workspace_manager;
 }
 
-static void workspace_group_handle_output_enter(void *data, zext_workspace_group_handle_v1 *_,
+static void workspace_group_handle_capabilities(void *data, zcosmic_workspace_group_handle_v1 *_,
+                                                struct wl_array *capabilities) {
+}
+
+static void workspace_group_handle_output_enter(void *data, zcosmic_workspace_group_handle_v1 *_,
                                                 wl_output *output) {
   static_cast<WorkspaceGroup *>(data)->handle_output_enter(output);
 }
 
-static void workspace_group_handle_output_leave(void *data, zext_workspace_group_handle_v1 *_,
+static void workspace_group_handle_output_leave(void *data, zcosmic_workspace_group_handle_v1 *_,
                                                 wl_output *output) {
   static_cast<WorkspaceGroup *>(data)->handle_output_leave();
 }
 
-static void workspace_group_handle_workspace(void *data, zext_workspace_group_handle_v1 *_,
-                                             zext_workspace_handle_v1 *workspace) {
+static void workspace_group_handle_workspace(void *data, zcosmic_workspace_group_handle_v1 *_,
+                                             zcosmic_workspace_handle_v1 *workspace) {
   static_cast<WorkspaceGroup *>(data)->handle_workspace_create(workspace);
 }
 
-static void workspace_group_handle_remove(void *data, zext_workspace_group_handle_v1 *_) {
+static void workspace_group_handle_remove(void *data, zcosmic_workspace_group_handle_v1 *_) {
   static_cast<WorkspaceGroup *>(data)->handle_remove();
 }
 
-static const zext_workspace_group_handle_v1_listener workspace_group_impl = {
+static const zcosmic_workspace_group_handle_v1_listener workspace_group_impl = {
+    .capabilities = workspace_group_handle_capabilities,
     .output_enter = workspace_group_handle_output_enter,
     .output_leave = workspace_group_handle_output_leave,
     .workspace = workspace_group_handle_workspace,
     .remove = workspace_group_handle_remove};
 
-void add_workspace_group_listener(zext_workspace_group_handle_v1 *workspace_group_handle,
+void add_workspace_group_listener(zcosmic_workspace_group_handle_v1 *workspace_group_handle,
                                   void *data) {
-  zext_workspace_group_handle_v1_add_listener(workspace_group_handle, &workspace_group_impl, data);
+  zcosmic_workspace_group_handle_v1_add_listener(workspace_group_handle, &workspace_group_impl, data);
+}
+
+void workspace_handle_capabilities(void *data, struct zcosmic_workspace_handle_v1 *_,
+                                   struct wl_array *capabilities) {
 }
 
-void workspace_handle_name(void *data, struct zext_workspace_handle_v1 *_, const char *name) {
+void workspace_handle_name(void *data, struct zcosmic_workspace_handle_v1 *_, const char *name) {
   static_cast<Workspace *>(data)->handle_name(name);
 }
 
-void workspace_handle_coordinates(void *data, struct zext_workspace_handle_v1 *_,
+void workspace_handle_coordinates(void *data, struct zcosmic_workspace_handle_v1 *_,
                                   struct wl_array *coordinates) {
   std::vector<uint32_t> coords_vec;
   auto coords = static_cast<uint32_t *>(coordinates->data);
@@ -109,7 +118,7 @@
   static_cast<Workspace *>(data)->handle_coordinates(coords_vec);
 }
 
-void workspace_handle_state(void *data, struct zext_workspace_handle_v1 *workspace_handle,
+void workspace_handle_state(void *data, struct zcosmic_workspace_handle_v1 *workspace_handle,
                             struct wl_array *state) {
   std::vector<uint32_t> state_vec;
   auto states = static_cast<uint32_t *>(state->data);
@@ -120,17 +129,18 @@
   static_cast<Workspace *>(data)->handle_state(state_vec);
 }
 
-void workspace_handle_remove(void *data, struct zext_workspace_handle_v1 *_) {
+void workspace_handle_remove(void *data, struct zcosmic_workspace_handle_v1 *_) {
   static_cast<Workspace *>(data)->handle_remove();
 }
 
-static const zext_workspace_handle_v1_listener workspace_impl = {
+static const zcosmic_workspace_handle_v1_listener workspace_impl = {
     .name = workspace_handle_name,
     .coordinates = workspace_handle_coordinates,
     .state = workspace_handle_state,
+    .capabilities = workspace_handle_capabilities,
     .remove = workspace_handle_remove};
 
-void add_workspace_listener(zext_workspace_handle_v1 *workspace_handle, void *data) {
-  zext_workspace_handle_v1_add_listener(workspace_handle, &workspace_impl, data);
+void add_workspace_listener(zcosmic_workspace_handle_v1 *workspace_handle, void *data) {
+  zcosmic_workspace_handle_v1_add_listener(workspace_handle, &workspace_impl, data);
 }
-}  // namespace waybar::modules::wlr
+}  // namespace waybar::modules::cosmic
--- src/modules/wlr/workspace_manager.cpp	2024-07-27 00:55:00.613836114 +0200
+++ src/modules/cosmic/cosmic_workspace_manager.cpp	2024-07-27 21:03:18.844683910 +0200
@@ -1,4 +1,4 @@
-#include "modules/wlr/workspace_manager.hpp"
+#include "modules/cosmic/cosmic_workspace_manager.hpp"
 
 #include <gdk/gdkwayland.h>
 #include <gtkmm.h>
@@ -11,9 +11,9 @@
 
 #include "client.hpp"
 #include "gtkmm/widget.h"
-#include "modules/wlr/workspace_manager_binding.hpp"
+#include "modules/cosmic/cosmic_workspace_manager_binding.hpp"
 
-namespace waybar::modules::wlr {
+namespace waybar::modules::cosmic {
 
 uint32_t WorkspaceGroup::workspace_global_id = 0;
 uint32_t WorkspaceManager::group_global_id = 0;
@@ -131,7 +131,7 @@
 }
 
 auto WorkspaceManager::handle_workspace_group_create(
-    zext_workspace_group_handle_v1 *workspace_group_handle) -> void {
+    zcosmic_workspace_group_handle_v1 *workspace_group_handle) -> void {
   auto new_id = ++group_global_id;
   groups_.push_back(
       std::make_unique<WorkspaceGroup>(bar_, box_, config_, *this, workspace_group_handle, new_id));
@@ -139,7 +139,7 @@
 }
 
 auto WorkspaceManager::handle_finished() -> void {
-  zext_workspace_manager_v1_destroy(workspace_manager_);
+  zcosmic_workspace_manager_v1_destroy(workspace_manager_);
   workspace_manager_ = nullptr;
 }
 
@@ -171,13 +171,13 @@
   // Send `stop` request and wait for one roundtrip. This is not quite correct as
   // the protocol encourages us to wait for the .finished event, but it should work
   // with wlroots workspace manager implementation.
-  zext_workspace_manager_v1_stop(workspace_manager_);
+  zcosmic_workspace_manager_v1_stop(workspace_manager_);
   wl_display_roundtrip(display);
 
   // If the .finished handler is still not executed, destroy the workspace manager here.
   if (workspace_manager_) {
-    spdlog::warn("Foreign toplevel manager destroyed before .finished event");
-    zext_workspace_manager_v1_destroy(workspace_manager_);
+    spdlog::warn("Workspace manager destroyed before .finished event");
+    zcosmic_workspace_manager_v1_destroy(workspace_manager_);
     workspace_manager_ = nullptr;
   }
 }
@@ -193,11 +193,11 @@
 
   groups_.erase(it);
 }
-auto WorkspaceManager::commit() -> void { zext_workspace_manager_v1_commit(workspace_manager_); }
+auto WorkspaceManager::commit() -> void { zcosmic_workspace_manager_v1_commit(workspace_manager_); }
 
 WorkspaceGroup::WorkspaceGroup(const Bar &bar, Gtk::Box &box, const Json::Value &config,
                                WorkspaceManager &manager,
-                               zext_workspace_group_handle_v1 *workspace_group_handle, uint32_t id)
+                               zcosmic_workspace_group_handle_v1 *workspace_group_handle, uint32_t id)
     : bar_(bar),
       box_(box),
       config_(config),
@@ -262,11 +262,11 @@
     return;
   }
 
-  zext_workspace_group_handle_v1_destroy(workspace_group_handle_);
+  zcosmic_workspace_group_handle_v1_destroy(workspace_group_handle_);
   workspace_group_handle_ = nullptr;
 }
 
-auto WorkspaceGroup::handle_workspace_create(zext_workspace_handle_v1 *workspace) -> void {
+auto WorkspaceGroup::handle_workspace_create(zcosmic_workspace_handle_v1 *workspace) -> void {
   auto new_id = ++workspace_global_id;
   workspaces_.push_back(std::make_unique<Workspace>(bar_, config_, *this, workspace, new_id, ""));
   spdlog::debug("Workspace {} created", new_id);
@@ -278,7 +278,7 @@
 }
 
 auto WorkspaceGroup::handle_remove() -> void {
-  zext_workspace_group_handle_v1_destroy(workspace_group_handle_);
+  zcosmic_workspace_group_handle_v1_destroy(workspace_group_handle_);
   workspace_group_handle_ = nullptr;
   workspace_manager_.remove_workspace_group(id_);
 }
@@ -373,7 +373,7 @@
 auto WorkspaceGroup::remove_button(Gtk::Button &button) -> void { box_.remove(button); }
 
 Workspace::Workspace(const Bar &bar, const Json::Value &config, WorkspaceGroup &workspace_group,
-                     zext_workspace_handle_v1 *workspace, uint32_t id, std::string name)
+                     zcosmic_workspace_handle_v1 *workspace, uint32_t id, std::string name)
     : bar_(bar),
       config_(config),
       workspace_group_(workspace_group),
@@ -424,7 +424,7 @@
     return;
   }
 
-  zext_workspace_handle_v1_destroy(workspace_handle_);
+  zcosmic_workspace_handle_v1_destroy(workspace_handle_);
   workspace_handle_ = nullptr;
 }
 
@@ -437,13 +437,13 @@
   state_ = 0;
   for (auto state_entry : state) {
     switch (state_entry) {
-      case ZEXT_WORKSPACE_HANDLE_V1_STATE_ACTIVE:
+      case ZCOSMIC_WORKSPACE_HANDLE_V1_STATE_ACTIVE:
         state_ |= (uint32_t)State::ACTIVE;
         break;
-      case ZEXT_WORKSPACE_HANDLE_V1_STATE_URGENT:
+      case ZCOSMIC_WORKSPACE_HANDLE_V1_STATE_URGENT:
         state_ |= (uint32_t)State::URGENT;
         break;
-      case ZEXT_WORKSPACE_HANDLE_V1_STATE_HIDDEN:
+      case ZCOSMIC_WORKSPACE_HANDLE_V1_STATE_HIDDEN:
         state_ |= (uint32_t)State::HIDDEN;
         break;
     }
@@ -452,7 +452,7 @@
 
 auto Workspace::handle_remove() -> void {
   if (workspace_handle_) {
-    zext_workspace_handle_v1_destroy(workspace_handle_);
+    zcosmic_workspace_handle_v1_destroy(workspace_handle_);
     workspace_handle_ = nullptr;
   }
   if (!persistent_) {
@@ -531,9 +531,9 @@
   if (action.empty())
     return true;
   else if (action == "activate") {
-    zext_workspace_handle_v1_activate(workspace_handle_);
+    zcosmic_workspace_handle_v1_activate(workspace_handle_);
   } else if (action == "close") {
-    zext_workspace_handle_v1_remove(workspace_handle_);
+    zcosmic_workspace_handle_v1_remove(workspace_handle_);
   } else {
     spdlog::warn("Unknown action {}", action);
   }
@@ -582,4 +582,4 @@
   }
   coordinates_ = coordinates;
 }
-}  // namespace waybar::modules::wlr
+}  // namespace waybar::modules::cosmic

cosmic-workspace-unstable-v1 is a vendored version of
the ext-workspace protocol and can be used without
hiding the implementation behind feature flags.

The only difference of version 1 in comparison to the
ext-workspaces protocol implemented in Waybar is an
added capability system.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant