cosmic-comp/cosmic-comp-config/src/workspace.rs
Ian Douglas Scott e54f4b4963 protocols/workspace: Set ext workspace id for pinned workspace
The `id` is defined to be sent only once, on creation of the handle or
later. And only for workspaces that are "likely to be stable across
multiple sessions".

Set we add an `id` initially for pinned workspaces, and add one when the
workspace is pinned.

The `id` is not supposed to be human readable, so we just use a random
value.
2025-08-22 11:58:07 +02:00

48 lines
1.1 KiB
Rust

// SPDX-License-Identifier: GPL-3.0-only
use serde::{Deserialize, Serialize};
use crate::output::EdidProduct;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct WorkspaceConfig {
pub workspace_mode: WorkspaceMode,
#[serde(default)]
pub workspace_layout: WorkspaceLayout,
}
impl Default for WorkspaceConfig {
fn default() -> Self {
Self {
workspace_mode: WorkspaceMode::OutputBound,
workspace_layout: WorkspaceLayout::Vertical,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum WorkspaceMode {
OutputBound,
Global,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
pub enum WorkspaceLayout {
#[default]
Vertical,
Horizontal,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct OutputMatch {
pub name: String,
pub edid: Option<EdidProduct>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct PinnedWorkspace {
pub output: OutputMatch,
pub tiling_enabled: bool,
pub id: Option<String>,
// TODO: name
}