config: workspace display order
This commit is contained in:
parent
40328d7c4a
commit
e570152dde
17 changed files with 237 additions and 11 deletions
|
|
@ -36,6 +36,7 @@ use {
|
||||||
ContentType, MatchedWindow, TileState, Window, WindowCriterion, WindowMatcher,
|
ContentType, MatchedWindow, TileState, Window, WindowCriterion, WindowMatcher,
|
||||||
WindowType,
|
WindowType,
|
||||||
},
|
},
|
||||||
|
workspace::WorkspaceDisplayOrder,
|
||||||
xwayland::XScalingMode,
|
xwayland::XScalingMode,
|
||||||
},
|
},
|
||||||
bincode::Options,
|
bincode::Options,
|
||||||
|
|
@ -987,6 +988,10 @@ impl ConfigClient {
|
||||||
self.send(&ClientMessage::SetMiddleClickPasteEnabled { enabled });
|
self.send(&ClientMessage::SetMiddleClickPasteEnabled { enabled });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_workspace_display_order(&self, order: WorkspaceDisplayOrder) {
|
||||||
|
self.send(&ClientMessage::SetWorkspaceDisplayOrder { order });
|
||||||
|
}
|
||||||
|
|
||||||
pub fn seat_create_mark(&self, seat: Seat, kc: Option<u32>) {
|
pub fn seat_create_mark(&self, seat: Seat, kc: Option<u32>) {
|
||||||
self.send(&ClientMessage::SeatCreateMark { seat, kc });
|
self.send(&ClientMessage::SeatCreateMark { seat, kc });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ use {
|
||||||
Transform, VrrMode, connector_type::ConnectorType,
|
Transform, VrrMode, connector_type::ConnectorType,
|
||||||
},
|
},
|
||||||
window::{ContentType, TileState, Window, WindowMatcher, WindowType},
|
window::{ContentType, TileState, Window, WindowMatcher, WindowType},
|
||||||
|
workspace::WorkspaceDisplayOrder,
|
||||||
xwayland::XScalingMode,
|
xwayland::XScalingMode,
|
||||||
},
|
},
|
||||||
serde::{Deserialize, Serialize},
|
serde::{Deserialize, Serialize},
|
||||||
|
|
@ -760,6 +761,9 @@ pub enum ClientMessage<'a> {
|
||||||
src: u32,
|
src: u32,
|
||||||
dst: u32,
|
dst: u32,
|
||||||
},
|
},
|
||||||
|
SetWorkspaceDisplayOrder {
|
||||||
|
order: WorkspaceDisplayOrder,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#[expect(unused_imports)]
|
#[expect(unused_imports)]
|
||||||
use crate::input::Seat;
|
use crate::input::Seat;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
_private::ipc::WorkspaceSource, keyboard::ModifiedKeySym, video::Connector, window::Window,
|
_private::ipc::WorkspaceSource, keyboard::ModifiedKeySym, video::Connector, window::Window,
|
||||||
|
|
@ -73,6 +74,7 @@ pub mod theme;
|
||||||
pub mod timer;
|
pub mod timer;
|
||||||
pub mod video;
|
pub mod video;
|
||||||
pub mod window;
|
pub mod window;
|
||||||
|
pub mod workspace;
|
||||||
pub mod xwayland;
|
pub mod xwayland;
|
||||||
|
|
||||||
/// A planar direction.
|
/// A planar direction.
|
||||||
|
|
|
||||||
19
jay-config/src/workspace.rs
Normal file
19
jay-config/src/workspace.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
//! Tools for configuring workspaces.
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
/// How workspaces should be ordered in the UI.
|
||||||
|
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||||
|
pub enum WorkspaceDisplayOrder {
|
||||||
|
/// Workspaces are not sorted and can be manually dragged.
|
||||||
|
Manual,
|
||||||
|
/// Workspaces are sorted alphabetically and cannot be manually dragged.
|
||||||
|
Sorted,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets how workspaces should be ordered in the UI.
|
||||||
|
///
|
||||||
|
/// The default is `WorkspaceDisplayOrder::Manual`.
|
||||||
|
pub fn set_workspace_display_order(order: WorkspaceDisplayOrder) {
|
||||||
|
get!().set_workspace_display_order(order);
|
||||||
|
}
|
||||||
|
|
@ -83,6 +83,7 @@ use {
|
||||||
jay_config::{
|
jay_config::{
|
||||||
_private::DEFAULT_SEAT_NAME,
|
_private::DEFAULT_SEAT_NAME,
|
||||||
video::{GfxApi, Transform},
|
video::{GfxApi, Transform},
|
||||||
|
workspace::WorkspaceDisplayOrder,
|
||||||
},
|
},
|
||||||
std::{cell::Cell, env, future::Future, ops::Deref, rc::Rc, sync::Arc, time::Duration},
|
std::{cell::Cell, env, future::Future, ops::Deref, rc::Rc, sync::Arc, time::Duration},
|
||||||
thiserror::Error,
|
thiserror::Error,
|
||||||
|
|
@ -357,6 +358,7 @@ fn start_compositor2(
|
||||||
show_bar: Cell::new(true),
|
show_bar: Cell::new(true),
|
||||||
enable_primary_selection: Cell::new(true),
|
enable_primary_selection: Cell::new(true),
|
||||||
xdg_surface_configure_events: Default::default(),
|
xdg_surface_configure_events: Default::default(),
|
||||||
|
workspace_display_order: Cell::new(WorkspaceDisplayOrder::Manual),
|
||||||
});
|
});
|
||||||
state.tracker.register(ClientId::from_raw(0));
|
state.tracker.register(ClientId::from_raw(0));
|
||||||
create_dummy_output(&state);
|
create_dummy_output(&state);
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ use {
|
||||||
Transform, VrrMode as ConfigVrrMode,
|
Transform, VrrMode as ConfigVrrMode,
|
||||||
},
|
},
|
||||||
window::{TileState, Window, WindowMatcher},
|
window::{TileState, Window, WindowMatcher},
|
||||||
|
workspace::WorkspaceDisplayOrder,
|
||||||
xwayland::XScalingMode,
|
xwayland::XScalingMode,
|
||||||
},
|
},
|
||||||
kbvm::Keycode,
|
kbvm::Keycode,
|
||||||
|
|
@ -1353,6 +1354,13 @@ impl ConfigProxyHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_set_workspace_display_order(&self, order: WorkspaceDisplayOrder) {
|
||||||
|
self.state.workspace_display_order.set(order);
|
||||||
|
for output in self.state.root.outputs.lock().values() {
|
||||||
|
output.handle_workspace_display_order_update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_get_seat_float_pinned(&self, seat: Seat) -> Result<(), CphError> {
|
fn handle_get_seat_float_pinned(&self, seat: Seat) -> Result<(), CphError> {
|
||||||
let seat = self.get_seat(seat)?;
|
let seat = self.get_seat(seat)?;
|
||||||
self.respond(Response::GetFloatPinned {
|
self.respond(Response::GetFloatPinned {
|
||||||
|
|
@ -3098,6 +3106,9 @@ impl ConfigProxyHandler {
|
||||||
ClientMessage::SetMiddleClickPasteEnabled { enabled } => {
|
ClientMessage::SetMiddleClickPasteEnabled { enabled } => {
|
||||||
self.handle_set_middle_click_paste_enabled(enabled)
|
self.handle_set_middle_click_paste_enabled(enabled)
|
||||||
}
|
}
|
||||||
|
ClientMessage::SetWorkspaceDisplayOrder { order } => {
|
||||||
|
self.handle_set_workspace_display_order(order)
|
||||||
|
}
|
||||||
ClientMessage::SeatCreateMark { seat, kc } => self
|
ClientMessage::SeatCreateMark { seat, kc } => self
|
||||||
.handle_seat_create_mark(seat, kc)
|
.handle_seat_create_mark(seat, kc)
|
||||||
.wrn("seat_create_mark")?,
|
.wrn("seat_create_mark")?,
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ use {
|
||||||
PciId,
|
PciId,
|
||||||
video::{GfxApi, Transform},
|
video::{GfxApi, Transform},
|
||||||
window::TileState,
|
window::TileState,
|
||||||
|
workspace::WorkspaceDisplayOrder,
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell},
|
||||||
|
|
@ -275,6 +276,7 @@ pub struct State {
|
||||||
pub show_bar: Cell<bool>,
|
pub show_bar: Cell<bool>,
|
||||||
pub enable_primary_selection: Cell<bool>,
|
pub enable_primary_selection: Cell<bool>,
|
||||||
pub xdg_surface_configure_events: AsyncQueue<XdgSurfaceConfigureEvent>,
|
pub xdg_surface_configure_events: AsyncQueue<XdgSurfaceConfigureEvent>,
|
||||||
|
pub workspace_display_order: Cell<WorkspaceDisplayOrder>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl Drop for State {
|
// impl Drop for State {
|
||||||
|
|
|
||||||
|
|
@ -48,17 +48,27 @@ use {
|
||||||
WorkspaceDragDestination, WorkspaceNode, WorkspaceNodeId, walker::NodeVisitor,
|
WorkspaceDragDestination, WorkspaceNode, WorkspaceNodeId, walker::NodeVisitor,
|
||||||
},
|
},
|
||||||
utils::{
|
utils::{
|
||||||
asyncevent::AsyncEvent, bitflags::BitflagsExt, clonecell::CloneCell,
|
asyncevent::AsyncEvent,
|
||||||
copyhashmap::CopyHashMap, errorfmt::ErrorFmt, event_listener::EventSource,
|
bitflags::BitflagsExt,
|
||||||
hash_map_ext::HashMapExt, linkedlist::LinkedList, on_drop_event::OnDropEvent,
|
clonecell::CloneCell,
|
||||||
scroller::Scroller, transform_ext::TransformExt,
|
copyhashmap::CopyHashMap,
|
||||||
|
errorfmt::ErrorFmt,
|
||||||
|
event_listener::EventSource,
|
||||||
|
hash_map_ext::HashMapExt,
|
||||||
|
linkedlist::{LinkedList, NodeRef},
|
||||||
|
on_drop_event::OnDropEvent,
|
||||||
|
scroller::Scroller,
|
||||||
|
transform_ext::TransformExt,
|
||||||
},
|
},
|
||||||
wire::{
|
wire::{
|
||||||
ExtImageCopyCaptureSessionV1Id, JayOutputId, JayScreencastId, ZwlrScreencopyFrameV1Id,
|
ExtImageCopyCaptureSessionV1Id, JayOutputId, JayScreencastId, ZwlrScreencopyFrameV1Id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ahash::AHashMap,
|
ahash::AHashMap,
|
||||||
jay_config::video::{TearingMode as ConfigTearingMode, Transform, VrrMode as ConfigVrrMode},
|
jay_config::{
|
||||||
|
video::{TearingMode as ConfigTearingMode, Transform, VrrMode as ConfigVrrMode},
|
||||||
|
workspace::WorkspaceDisplayOrder,
|
||||||
|
},
|
||||||
smallvec::SmallVec,
|
smallvec::SmallVec,
|
||||||
std::{
|
std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell},
|
||||||
|
|
@ -712,6 +722,17 @@ impl OutputNode {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn find_workspace_insertion_point(&self, name: &str) -> Option<NodeRef<Rc<WorkspaceNode>>> {
|
||||||
|
if self.state.workspace_display_order.get() == WorkspaceDisplayOrder::Sorted {
|
||||||
|
for existing_ws in self.workspaces.iter() {
|
||||||
|
if name < existing_ws.name.as_str() {
|
||||||
|
return Some(existing_ws);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
pub fn create_workspace(self: &Rc<Self>, name: &str) -> Rc<WorkspaceNode> {
|
pub fn create_workspace(self: &Rc<Self>, name: &str) -> Rc<WorkspaceNode> {
|
||||||
let ws = Rc::new(WorkspaceNode {
|
let ws = Rc::new(WorkspaceNode {
|
||||||
id: self.state.node_ids.next(),
|
id: self.state.node_ids.next(),
|
||||||
|
|
@ -740,7 +761,12 @@ impl OutputNode {
|
||||||
});
|
});
|
||||||
ws.opt.set(Some(ws.clone()));
|
ws.opt.set(Some(ws.clone()));
|
||||||
ws.update_has_captures();
|
ws.update_has_captures();
|
||||||
*ws.output_link.borrow_mut() = Some(self.workspaces.add_last(ws.clone()));
|
let link = if let Some(before) = self.find_workspace_insertion_point(name) {
|
||||||
|
before.prepend(ws.clone())
|
||||||
|
} else {
|
||||||
|
self.workspaces.add_last(ws.clone())
|
||||||
|
};
|
||||||
|
*ws.output_link.borrow_mut() = Some(link);
|
||||||
self.state.workspaces.set(name.to_string(), ws.clone());
|
self.state.workspaces.set(name.to_string(), ws.clone());
|
||||||
if self.workspace.is_none() {
|
if self.workspace.is_none() {
|
||||||
self.show_workspace(&ws);
|
self.show_workspace(&ws);
|
||||||
|
|
@ -1048,6 +1074,18 @@ impl OutputNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn handle_workspace_display_order_update(self: &Rc<Self>) {
|
||||||
|
if self.state.workspace_display_order.get() == WorkspaceDisplayOrder::Sorted {
|
||||||
|
let mut workspaces: Vec<_> = self.workspaces.iter().collect();
|
||||||
|
workspaces.sort_by(|a, b| a.name.cmp(&b.name));
|
||||||
|
for ws_ref in workspaces {
|
||||||
|
ws_ref.detach();
|
||||||
|
self.workspaces.add_last_existing(&ws_ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.schedule_update_render_data();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update_visible(&self) {
|
pub fn update_visible(&self) {
|
||||||
let mut visible = self.state.root_visible();
|
let mut visible = self.state.root_visible();
|
||||||
if self.state.lock.locked.get() {
|
if self.state.lock.locked.get() {
|
||||||
|
|
@ -1285,6 +1323,16 @@ impl OutputNode {
|
||||||
if y_abs - rect.y1() > th + 1 {
|
if y_abs - rect.y1() > th + 1 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
if self.state.workspace_display_order.get() == WorkspaceDisplayOrder::Sorted {
|
||||||
|
if self.workspaces.iter().any(|ws| ws.id == source) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
return Some(WorkspaceDragDestination {
|
||||||
|
highlight: Rect::new_sized(rect.x1(), rect.y1(), rect.width(), th)?,
|
||||||
|
output: self.clone(),
|
||||||
|
before: None,
|
||||||
|
});
|
||||||
|
}
|
||||||
let rd = &*self.render_data.borrow();
|
let rd = &*self.render_data.borrow();
|
||||||
let (x, _) = rect.translate(x_abs, y_abs);
|
let (x, _) = rect.translate(x_abs, y_abs);
|
||||||
let mut prev_is_source = false;
|
let mut prev_is_source = false;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ use {
|
||||||
},
|
},
|
||||||
wire::JayWorkspaceId,
|
wire::JayWorkspaceId,
|
||||||
},
|
},
|
||||||
|
jay_config::workspace::WorkspaceDisplayOrder,
|
||||||
std::{
|
std::{
|
||||||
cell::{Cell, RefCell},
|
cell::{Cell, RefCell},
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
|
|
@ -491,8 +492,15 @@ pub fn move_ws_to_output(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ws.set_output(&target);
|
ws.set_output(&target);
|
||||||
|
let before = if target.state.workspace_display_order.get() == WorkspaceDisplayOrder::Sorted {
|
||||||
|
target
|
||||||
|
.find_workspace_insertion_point(&ws.name)
|
||||||
|
.map(|nr| nr.deref().clone())
|
||||||
|
} else {
|
||||||
|
config.before
|
||||||
|
};
|
||||||
'link: {
|
'link: {
|
||||||
if let Some(before) = config.before
|
if let Some(before) = before
|
||||||
&& let Some(link) = &*before.output_link.borrow()
|
&& let Some(link) = &*before.output_link.borrow()
|
||||||
{
|
{
|
||||||
link.prepend_existing(ws);
|
link.prepend_existing(ws);
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ use {
|
||||||
theme::Color,
|
theme::Color,
|
||||||
video::{ColorSpace, Format, GfxApi, TearingMode, TransferFunction, Transform, VrrMode},
|
video::{ColorSpace, Format, GfxApi, TearingMode, TransferFunction, Transform, VrrMode},
|
||||||
window::{ContentType, TileState, WindowType},
|
window::{ContentType, TileState, WindowType},
|
||||||
|
workspace::WorkspaceDisplayOrder,
|
||||||
xwayland::XScalingMode,
|
xwayland::XScalingMode,
|
||||||
},
|
},
|
||||||
std::{
|
std::{
|
||||||
|
|
@ -509,6 +510,7 @@ pub struct Config {
|
||||||
pub focus_history: Option<FocusHistory>,
|
pub focus_history: Option<FocusHistory>,
|
||||||
pub middle_click_paste: Option<bool>,
|
pub middle_click_paste: Option<bool>,
|
||||||
pub input_modes: AHashMap<String, InputMode>,
|
pub input_modes: AHashMap<String, InputMode>,
|
||||||
|
pub workspace_display_order: Option<WorkspaceDisplayOrder>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ mod vrr;
|
||||||
mod window_match;
|
mod window_match;
|
||||||
mod window_rule;
|
mod window_rule;
|
||||||
mod window_type;
|
mod window_type;
|
||||||
|
mod workspace_display_order;
|
||||||
mod xwayland;
|
mod xwayland;
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ use {
|
||||||
ui_drag::UiDragParser,
|
ui_drag::UiDragParser,
|
||||||
vrr::VrrParser,
|
vrr::VrrParser,
|
||||||
window_rule::WindowRulesParser,
|
window_rule::WindowRulesParser,
|
||||||
|
workspace_display_order::WorkspaceDisplayOrderParser,
|
||||||
xwayland::XwaylandParser,
|
xwayland::XwaylandParser,
|
||||||
},
|
},
|
||||||
spanned::SpannedErrorExt,
|
spanned::SpannedErrorExt,
|
||||||
|
|
@ -138,7 +139,7 @@ impl Parser for ConfigParser<'_> {
|
||||||
show_bar,
|
show_bar,
|
||||||
focus_history_val,
|
focus_history_val,
|
||||||
),
|
),
|
||||||
(middle_click_paste, input_modes_val),
|
(middle_click_paste, input_modes_val, workspace_display_order_val),
|
||||||
) = ext.extract((
|
) = ext.extract((
|
||||||
(
|
(
|
||||||
opt(val("keymap")),
|
opt(val("keymap")),
|
||||||
|
|
@ -188,7 +189,11 @@ impl Parser for ConfigParser<'_> {
|
||||||
recover(opt(bol("show-bar"))),
|
recover(opt(bol("show-bar"))),
|
||||||
opt(val("focus-history")),
|
opt(val("focus-history")),
|
||||||
),
|
),
|
||||||
(recover(opt(bol("middle-click-paste"))), opt(val("modes"))),
|
(
|
||||||
|
recover(opt(bol("middle-click-paste"))),
|
||||||
|
opt(val("modes")),
|
||||||
|
opt(val("workspace-display-order")),
|
||||||
|
),
|
||||||
))?;
|
))?;
|
||||||
let mut keymap = None;
|
let mut keymap = None;
|
||||||
if let Some(value) = keymap_val {
|
if let Some(value) = keymap_val {
|
||||||
|
|
@ -486,6 +491,18 @@ impl Parser for ConfigParser<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let mut workspace_display_order = None;
|
||||||
|
if let Some(value) = workspace_display_order_val {
|
||||||
|
match value.parse(&mut WorkspaceDisplayOrderParser) {
|
||||||
|
Ok(v) => workspace_display_order = Some(v),
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!(
|
||||||
|
"Could not parse the workspace display order: {}",
|
||||||
|
self.0.error(e)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(Config {
|
Ok(Config {
|
||||||
keymap,
|
keymap,
|
||||||
repeat_rate,
|
repeat_rate,
|
||||||
|
|
@ -528,6 +545,7 @@ impl Parser for ConfigParser<'_> {
|
||||||
focus_history,
|
focus_history,
|
||||||
middle_click_paste: middle_click_paste.despan(),
|
middle_click_paste: middle_click_paste.despan(),
|
||||||
input_modes,
|
input_modes,
|
||||||
|
workspace_display_order,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
32
toml-config/src/config/parsers/workspace_display_order.rs
Normal file
32
toml-config/src/config/parsers/workspace_display_order.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
use {
|
||||||
|
crate::{
|
||||||
|
config::parser::{DataType, ParseResult, Parser, UnexpectedDataType},
|
||||||
|
toml::toml_span::{Span, SpannedExt},
|
||||||
|
},
|
||||||
|
jay_config::workspace::WorkspaceDisplayOrder,
|
||||||
|
thiserror::Error,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
pub enum WorkspaceDisplayOrderParserError {
|
||||||
|
#[error(transparent)]
|
||||||
|
Expected(#[from] UnexpectedDataType),
|
||||||
|
#[error("Unknown workspace display order {0}")]
|
||||||
|
Unknown(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct WorkspaceDisplayOrderParser;
|
||||||
|
|
||||||
|
impl Parser for WorkspaceDisplayOrderParser {
|
||||||
|
type Value = WorkspaceDisplayOrder;
|
||||||
|
type Error = WorkspaceDisplayOrderParserError;
|
||||||
|
const EXPECTED: &'static [DataType] = &[DataType::String];
|
||||||
|
|
||||||
|
fn parse_string(&mut self, span: Span, string: &str) -> ParseResult<Self> {
|
||||||
|
match string {
|
||||||
|
"manual" => Ok(WorkspaceDisplayOrder::Manual),
|
||||||
|
"sorted" => Ok(WorkspaceDisplayOrder::Sorted),
|
||||||
|
_ => Err(WorkspaceDisplayOrderParserError::Unknown(string.to_string()).spanned(span)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -50,6 +50,7 @@ use {
|
||||||
set_tearing_mode, set_vrr_cursor_hz, set_vrr_mode,
|
set_tearing_mode, set_vrr_cursor_hz, set_vrr_mode,
|
||||||
},
|
},
|
||||||
window::Window,
|
window::Window,
|
||||||
|
workspace::set_workspace_display_order,
|
||||||
xwayland::set_x_scaling_mode,
|
xwayland::set_x_scaling_mode,
|
||||||
},
|
},
|
||||||
run_on_drop::on_drop,
|
run_on_drop::on_drop,
|
||||||
|
|
@ -1306,6 +1307,9 @@ fn load_config(initial_load: bool, persistent: &Rc<PersistentState>) {
|
||||||
if let Some(v) = config.middle_click_paste {
|
if let Some(v) = config.middle_click_paste {
|
||||||
set_middle_click_paste_enabled(v);
|
set_middle_click_paste_enabled(v);
|
||||||
}
|
}
|
||||||
|
if let Some(v) = config.workspace_display_order {
|
||||||
|
set_workspace_display_order(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_command(exec: &Exec) -> Command {
|
fn create_command(exec: &Exec) -> Command {
|
||||||
|
|
|
||||||
|
|
@ -991,6 +991,10 @@
|
||||||
"description": "",
|
"description": "",
|
||||||
"$ref": "#/$defs/InputMode"
|
"$ref": "#/$defs/InputMode"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"workspace-display-order": {
|
||||||
|
"description": "Configures the order of workspaces displayed.\n\nThe default is `manual`.\n\n- Example:\n\n ```toml\n workspace-display-order = \"sorted\"\n ```\n",
|
||||||
|
"$ref": "#/$defs/WorkspaceDisplayOrder"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": []
|
"required": []
|
||||||
|
|
@ -2179,6 +2183,14 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"WorkspaceDisplayOrder": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The order of workspaces displayed.\n",
|
||||||
|
"enum": [
|
||||||
|
"manual",
|
||||||
|
"sorted"
|
||||||
|
]
|
||||||
|
},
|
||||||
"XScalingMode": {
|
"XScalingMode": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The scaling mode of X windows.\n\n- Example:\n\n ```toml\n xwayland = { scaling-mode = \"downscaled\" }\n ```\n",
|
"description": "The scaling mode of X windows.\n\n- Example:\n\n ```toml\n xwayland = { scaling-mode = \"downscaled\" }\n ```\n",
|
||||||
|
|
|
||||||
|
|
@ -1976,6 +1976,20 @@ The table has the following fields:
|
||||||
|
|
||||||
The value of this field should be a table whose values are [InputModes](#types-InputMode).
|
The value of this field should be a table whose values are [InputModes](#types-InputMode).
|
||||||
|
|
||||||
|
- `workspace-display-order` (optional):
|
||||||
|
|
||||||
|
Configures the order of workspaces displayed.
|
||||||
|
|
||||||
|
The default is `manual`.
|
||||||
|
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
workspace-display-order = "sorted"
|
||||||
|
```
|
||||||
|
|
||||||
|
The value of this field should be a [WorkspaceDisplayOrder](#types-WorkspaceDisplayOrder).
|
||||||
|
|
||||||
|
|
||||||
<a name="types-Connector"></a>
|
<a name="types-Connector"></a>
|
||||||
### `Connector`
|
### `Connector`
|
||||||
|
|
@ -4761,6 +4775,25 @@ An array of masks that are OR'd.
|
||||||
Each element of this array should be a [WindowTypeMask](#types-WindowTypeMask).
|
Each element of this array should be a [WindowTypeMask](#types-WindowTypeMask).
|
||||||
|
|
||||||
|
|
||||||
|
<a name="types-WorkspaceDisplayOrder"></a>
|
||||||
|
### `WorkspaceDisplayOrder`
|
||||||
|
|
||||||
|
The order of workspaces displayed.
|
||||||
|
|
||||||
|
Values of this type should be strings.
|
||||||
|
|
||||||
|
The string should have one of the following values:
|
||||||
|
|
||||||
|
- `manual`:
|
||||||
|
|
||||||
|
Workspaces are not sorted and can be manually dragged.
|
||||||
|
|
||||||
|
- `sorted`:
|
||||||
|
|
||||||
|
Workspaces are sorted alphabetically and cannot be manually dragged.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="types-XScalingMode"></a>
|
<a name="types-XScalingMode"></a>
|
||||||
### `XScalingMode`
|
### `XScalingMode`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2122,7 +2122,6 @@ Theme:
|
||||||
description: The name of the font to use.
|
description: The name of the font to use.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Config:
|
Config:
|
||||||
kind: table
|
kind: table
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -2802,8 +2801,21 @@ Config:
|
||||||
q = "focus-prev"
|
q = "focus-prev"
|
||||||
e = "focus-next"
|
e = "focus-next"
|
||||||
```
|
```
|
||||||
|
|
||||||
Modes can be activated with the `push-mode` and `latch-mode` actions.
|
Modes can be activated with the `push-mode` and `latch-mode` actions.
|
||||||
|
workspace-display-order:
|
||||||
|
ref: WorkspaceDisplayOrder
|
||||||
|
required: false
|
||||||
|
description: |
|
||||||
|
Configures the order of workspaces displayed.
|
||||||
|
|
||||||
|
The default is `manual`.
|
||||||
|
|
||||||
|
- Example:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
workspace-display-order = "sorted"
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Idle:
|
Idle:
|
||||||
|
|
@ -4006,3 +4018,14 @@ InputMode:
|
||||||
The complex shortcuts of this mode.
|
The complex shortcuts of this mode.
|
||||||
|
|
||||||
See the same field in the top-level `Config` object for a description.
|
See the same field in the top-level `Config` object for a description.
|
||||||
|
|
||||||
|
|
||||||
|
WorkspaceDisplayOrder:
|
||||||
|
kind: string
|
||||||
|
description: |
|
||||||
|
The order of workspaces displayed.
|
||||||
|
values:
|
||||||
|
- value: manual
|
||||||
|
description: Workspaces are not sorted and can be manually dragged.
|
||||||
|
- value: sorted
|
||||||
|
description: Workspaces are sorted alphabetically and cannot be manually dragged.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue