feat: allow naming pinned workspaces
This commit is contained in:
parent
8f5f7c897d
commit
db0b1afeb5
3 changed files with 19 additions and 3 deletions
|
|
@ -63,5 +63,5 @@ pub struct PinnedWorkspace {
|
||||||
pub output: OutputMatch,
|
pub output: OutputMatch,
|
||||||
pub tiling_enabled: bool,
|
pub tiling_enabled: bool,
|
||||||
pub id: Option<String>,
|
pub id: Option<String>,
|
||||||
// TODO: name
|
pub name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -439,6 +439,11 @@ fn create_workspace_from_pinned(
|
||||||
| WorkspaceCapabilities::Pin
|
| WorkspaceCapabilities::Pin
|
||||||
| WorkspaceCapabilities::Move,
|
| WorkspaceCapabilities::Move,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if let Some(ref name) = pinned.name {
|
||||||
|
state.set_workspace_name(&workspace_handle, name);
|
||||||
|
}
|
||||||
|
|
||||||
Workspace::from_pinned(
|
Workspace::from_pinned(
|
||||||
pinned,
|
pinned,
|
||||||
workspace_handle,
|
workspace_handle,
|
||||||
|
|
@ -619,6 +624,7 @@ impl WorkspaceSet {
|
||||||
state,
|
state,
|
||||||
self.workspaces.len() as u8 + 1,
|
self.workspaces.len() as u8 + 1,
|
||||||
&workspace.handle,
|
&workspace.handle,
|
||||||
|
workspace.name.as_deref(),
|
||||||
// this method is only used by code paths related to dynamic workspaces, so this should be fine
|
// this method is only used by code paths related to dynamic workspaces, so this should be fine
|
||||||
);
|
);
|
||||||
self.workspaces.push(workspace);
|
self.workspaces.push(workspace);
|
||||||
|
|
@ -680,7 +686,12 @@ impl WorkspaceSet {
|
||||||
|
|
||||||
fn update_workspace_idxs(&self, state: &mut WorkspaceUpdateGuard<'_, State>) {
|
fn update_workspace_idxs(&self, state: &mut WorkspaceUpdateGuard<'_, State>) {
|
||||||
for (i, workspace) in self.workspaces.iter().enumerate() {
|
for (i, workspace) in self.workspaces.iter().enumerate() {
|
||||||
workspace_set_idx(state, i as u8 + 1, &workspace.handle);
|
workspace_set_idx(
|
||||||
|
state,
|
||||||
|
i as u8 + 1,
|
||||||
|
&workspace.handle,
|
||||||
|
workspace.name.as_deref(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5025,8 +5036,9 @@ fn workspace_set_idx(
|
||||||
state: &mut WorkspaceUpdateGuard<'_, State>,
|
state: &mut WorkspaceUpdateGuard<'_, State>,
|
||||||
idx: u8,
|
idx: u8,
|
||||||
handle: &WorkspaceHandle,
|
handle: &WorkspaceHandle,
|
||||||
|
name: Option<&str>,
|
||||||
) {
|
) {
|
||||||
state.set_workspace_name(handle, format!("{}", idx));
|
state.set_workspace_name(handle, name.unwrap_or(&format!("{}", idx)));
|
||||||
state.set_workspace_coordinates(handle, &[idx as u32]);
|
state.set_workspace_coordinates(handle, &[idx as u32]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ pub struct Workspace {
|
||||||
pub fullscreen_surfaces: Vec<FullscreenSurface>,
|
pub fullscreen_surfaces: Vec<FullscreenSurface>,
|
||||||
pub pinned: bool,
|
pub pinned: bool,
|
||||||
pub id: Option<String>,
|
pub id: Option<String>,
|
||||||
|
pub name: Option<String>,
|
||||||
|
|
||||||
pub handle: WorkspaceHandle,
|
pub handle: WorkspaceHandle,
|
||||||
pub focus_stack: FocusStacks,
|
pub focus_stack: FocusStacks,
|
||||||
|
|
@ -386,6 +387,7 @@ impl Workspace {
|
||||||
fullscreen_surfaces: Vec::new(),
|
fullscreen_surfaces: Vec::new(),
|
||||||
pinned: false,
|
pinned: false,
|
||||||
id: None,
|
id: None,
|
||||||
|
name: None,
|
||||||
handle,
|
handle,
|
||||||
focus_stack: FocusStacks::default(),
|
focus_stack: FocusStacks::default(),
|
||||||
image_copy: ImageCopySessions::default(),
|
image_copy: ImageCopySessions::default(),
|
||||||
|
|
@ -419,6 +421,7 @@ impl Workspace {
|
||||||
fullscreen_surfaces: Vec::new(),
|
fullscreen_surfaces: Vec::new(),
|
||||||
pinned: true,
|
pinned: true,
|
||||||
id: pinned.id.clone(),
|
id: pinned.id.clone(),
|
||||||
|
name: pinned.name.clone(),
|
||||||
handle,
|
handle,
|
||||||
focus_stack: FocusStacks::default(),
|
focus_stack: FocusStacks::default(),
|
||||||
image_copy: ImageCopySessions::default(),
|
image_copy: ImageCopySessions::default(),
|
||||||
|
|
@ -446,6 +449,7 @@ impl Workspace {
|
||||||
},
|
},
|
||||||
tiling_enabled: self.tiling_enabled,
|
tiling_enabled: self.tiling_enabled,
|
||||||
id: self.id.clone(),
|
id: self.id.clone(),
|
||||||
|
name: self.name.clone(),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue