Initial support for workspace pinning and moving
Adds support for cosmic-workspace-v2 pin, unpin, move_after, and move_before requests. Both features need some work with workspaces span displays mode, so that will need more fixes later. We also want to generate a unique id for pinned workspaces to send in the ext-workspace-v1 protocol. But that isn't a strict requirement for anything. So I haven't yet fully implemented that. We'll also want to persist other things, like workspace naming when that's added. Overall, though, with separate workspaces per display, this is working pretty well.
This commit is contained in:
parent
d1f4e7b12d
commit
96e9bf3b81
14 changed files with 622 additions and 118 deletions
|
|
@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||
use std::collections::HashMap;
|
||||
|
||||
pub mod input;
|
||||
pub mod output;
|
||||
pub mod workspace;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -25,6 +26,7 @@ pub enum NumlockState {
|
|||
#[version = 1]
|
||||
pub struct CosmicCompConfig {
|
||||
pub workspaces: workspace::WorkspaceConfig,
|
||||
pub pinned_workspaces: Vec<workspace::PinnedWorkspace>,
|
||||
pub input_default: input::InputConfig,
|
||||
pub input_touchpad: input::InputConfig,
|
||||
pub input_devices: HashMap<String, input::InputConfig>,
|
||||
|
|
@ -57,6 +59,7 @@ impl Default for CosmicCompConfig {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
workspaces: Default::default(),
|
||||
pinned_workspaces: Vec::new(),
|
||||
input_default: Default::default(),
|
||||
// By default, enable tap-to-click and disable-while-typing.
|
||||
input_touchpad: input::InputConfig {
|
||||
|
|
|
|||
27
cosmic-comp-config/src/output.rs
Normal file
27
cosmic-comp-config/src/output.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct EdidProduct {
|
||||
pub manufacturer: [char; 3],
|
||||
pub product: u16,
|
||||
pub serial: Option<u32>,
|
||||
pub manufacture_week: i32,
|
||||
pub manufacture_year: i32,
|
||||
pub model_year: Option<i32>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "libdisplay-info")]
|
||||
impl From<libdisplay_info::edid::VendorProduct> for EdidProduct {
|
||||
fn from(vp: libdisplay_info::edid::VendorProduct) -> Self {
|
||||
Self {
|
||||
manufacturer: vp.manufacturer,
|
||||
product: vp.product,
|
||||
serial: vp.serial,
|
||||
manufacture_week: vp.manufacture_week,
|
||||
manufacture_year: vp.manufacture_year,
|
||||
model_year: vp.model_year,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::output::EdidProduct;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct WorkspaceConfig {
|
||||
pub workspace_mode: WorkspaceMode,
|
||||
|
|
@ -30,3 +32,16 @@ pub enum WorkspaceLayout {
|
|||
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,
|
||||
// TODO: name, id
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue