1
0
Fork 0
forked from wry/wry

config: add XWayland enabled option

This commit is contained in:
khyperia 2026-02-17 10:18:20 +01:00 committed by Julian Orth
parent 4ca67772b3
commit 49274fb1c6
13 changed files with 85 additions and 10 deletions

View file

@ -463,6 +463,7 @@ pub struct SimpleIm {
#[derive(Debug, Clone)]
pub struct Xwayland {
pub enabled: Option<bool>,
pub scaling_mode: Option<XScalingMode>,
}

View file

@ -3,11 +3,11 @@ use {
config::{
Xwayland,
context::Context,
extractor::{Extractor, ExtractorError, opt, val},
extractor::{Extractor, ExtractorError, bol, opt, recover, val},
parser::{DataType, ParseResult, Parser, UnexpectedDataType},
},
toml::{
toml_span::{Span, Spanned, SpannedExt},
toml_span::{DespanExt, Span, Spanned, SpannedExt},
toml_value::Value,
},
},
@ -37,7 +37,8 @@ impl Parser for XwaylandParser<'_> {
table: &IndexMap<Spanned<String>, Spanned<Value>>,
) -> ParseResult<Self> {
let mut ext = Extractor::new(self.0, span, table);
let scaling_mode = ext.extract(opt(val("scaling-mode")))?;
let (enabled, scaling_mode) =
ext.extract((recover(opt(bol("enabled"))), opt(val("scaling-mode"))))?;
let scaling_mode = scaling_mode.and_then(|m| match m.parse(&mut XScalingModeParser) {
Ok(m) => Some(m),
Err(e) => {
@ -45,7 +46,10 @@ impl Parser for XwaylandParser<'_> {
None
}
});
Ok(Xwayland { scaling_mode })
Ok(Xwayland {
enabled: enabled.despan(),
scaling_mode,
})
}
}

View file

@ -56,7 +56,7 @@ use {
},
window::Window,
workspace::set_workspace_display_order,
xwayland::set_x_scaling_mode,
xwayland::{set_x_scaling_mode, set_x_wayland_enabled},
},
run_on_drop::on_drop,
std::{
@ -1578,10 +1578,13 @@ fn load_config(initial_load: bool, auto_reload: bool, persistent: &Rc<Persistent
if let Some(threshold) = config.ui_drag.threshold {
set_ui_drag_threshold(threshold);
}
if let Some(xwayland) = config.xwayland
&& let Some(mode) = xwayland.scaling_mode
{
set_x_scaling_mode(mode);
if let Some(xwayland) = config.xwayland {
if let Some(enabled) = xwayland.enabled {
set_x_wayland_enabled(enabled);
}
if let Some(mode) = xwayland.scaling_mode {
set_x_scaling_mode(mode);
}
}
if let Some(cm) = config.color_management
&& let Some(enabled) = cm.enabled