Skip to content

Commit

Permalink
Merge pull request #22 from pop-os/workspace-additions
Browse files Browse the repository at this point in the history
workspace: Add tiling/name controls
  • Loading branch information
Drakulix authored Jan 3, 2024
2 parents c1b6516 + 16dabd0 commit da8602e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
7 changes: 6 additions & 1 deletion client-toolkit/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct Workspace {
pub coordinates: Vec<u32>,
pub state: Vec<WEnum<zcosmic_workspace_handle_v1::State>>,
pub capabilities: Vec<WEnum<zcosmic_workspace_handle_v1::ZcosmicWorkspaceCapabilitiesV1>>,
pub tiling: Option<WEnum<zcosmic_workspace_handle_v1::TilingState>>,
}

#[derive(Debug)]
Expand All @@ -35,7 +36,7 @@ impl WorkspaceState {
{
Self {
workspace_groups: Vec::new(),
manager: GlobalProxy::from(registry.bind_one(qh, 1..=1, ())),
manager: GlobalProxy::from(registry.bind_one(qh, 1..=2, ())),
}
}

Expand Down Expand Up @@ -141,6 +142,7 @@ where
coordinates: Vec::new(),
state: Vec::new(),
capabilities: Vec::new(),
tiling: None,
});
}
zcosmic_workspace_group_handle_v1::Event::Remove => {
Expand Down Expand Up @@ -202,6 +204,9 @@ where
.map(|chunk| WEnum::from(u32::from_ne_bytes(chunk.try_into().unwrap())))
.collect();
}
zcosmic_workspace_handle_v1::Event::TilingState { state } => {
workspace.tiling_enabled = Some(state);
}
zcosmic_workspace_handle_v1::Event::Remove => {
for group in state.workspace_state().workspace_groups.iter_mut() {
if let Some(idx) = group.workspaces.iter().position(|w| &w.handle == handle) {
Expand Down
38 changes: 37 additions & 1 deletion unstable/cosmic-workspace-unstable-v1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
</request>
</interface>

<interface name="zcosmic_workspace_handle_v1" version="1">
<interface name="zcosmic_workspace_handle_v1" version="2">
<description summary="a workspace handing a group of surfaces">
A zcosmic_workspace_handle_v1 object represents a a workspace that handles a
group of surfaces.
Expand Down Expand Up @@ -291,6 +291,8 @@
<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"/>
<entry name="rename" value="4" since="2" summary="rename request is available"/>
<entry name="set_tiling_state" value="5" since="2" summary="set_tiling_state request is available"/>
</enum>

<event name="capabilities">
Expand Down Expand Up @@ -360,5 +362,39 @@
There is no guarantee the workspace will be actually removed.
</description>
</request>

<event name="tiling_state" since="2">
<description summary="indicates if tiling behavior is enabled for this workspace">
This event is emitted immediately after the zcosmic_workspace_handle_v1 is created
and each time the workspace tiling state changes, either because of a
compositor action or because of a request in this protocol.
</description>
<arg name="state" type="uint" enum="tiling_state"/>
</event>

<enum name="tiling_state" since="2">
<description summary="types of tiling state a workspace may have"/>

<entry name="floating_only" value="0" summary="The workspace has no active tiling properties"/>
<entry name="tiling_enabled" value="1" summary="Tiling behavior is enabled for the workspace"/>
</enum>

<request name="rename" since="2">
<description summary="rename this workspace">
Request that this workspace is renamed.

There is no guarantee the workspace will actually be renamed.
</description>
<arg name="name" type="string" summary="new name of the workspace"/>
</request>

<request name="set_tiling_state" since="2">
<description summary="change the tiling state of this workspace">
Request that this workspace's tiling state is changed.

There is no guarantee the workspace will actually change it's tiling state.
</description>
<arg name="state" type="uint" enum="tiling_state" summary="the new tiling state of the workspace"/>
</request>
</interface>
</protocol>

0 comments on commit da8602e

Please sign in to comment.