feat(legacy_apps): Add new scaling modes
This commit is contained in:
parent
9e94291216
commit
8cec1acc1e
2 changed files with 37 additions and 18 deletions
|
|
@ -7,7 +7,7 @@ use cosmic::{
|
||||||
iced::Length,
|
iced::Length,
|
||||||
widget::{self, text},
|
widget::{self, text},
|
||||||
};
|
};
|
||||||
use cosmic_comp_config::{EavesdroppingKeyboardMode, XwaylandEavesdropping};
|
use cosmic_comp_config::{EavesdroppingKeyboardMode, XwaylandDescaling, XwaylandEavesdropping};
|
||||||
use cosmic_settings_page::Section;
|
use cosmic_settings_page::Section;
|
||||||
use cosmic_settings_page::{self as page, section};
|
use cosmic_settings_page::{self as page, section};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
|
@ -16,14 +16,14 @@ use tracing::error;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
SetXwaylandDescaling(bool),
|
SetXwaylandDescaling(XwaylandDescaling),
|
||||||
SetXwaylandKeyboardMode(EavesdroppingKeyboardMode),
|
SetXwaylandKeyboardMode(EavesdroppingKeyboardMode),
|
||||||
SetXwaylandMouseButtonMode(bool),
|
SetXwaylandMouseButtonMode(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
comp_config: cosmic_config::Config,
|
comp_config: cosmic_config::Config,
|
||||||
comp_config_descale_xwayland: bool,
|
comp_config_descale_xwayland: XwaylandDescaling,
|
||||||
comp_config_xwayland_eavesdropping: XwaylandEavesdropping,
|
comp_config_xwayland_eavesdropping: XwaylandEavesdropping,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ impl Default for Page {
|
||||||
error!(?err, "Failed to read config 'descale_xwayland'");
|
error!(?err, "Failed to read config 'descale_xwayland'");
|
||||||
}
|
}
|
||||||
|
|
||||||
false
|
XwaylandDescaling::Disabled
|
||||||
});
|
});
|
||||||
let comp_config_xwayland_eavesdropping = comp_config
|
let comp_config_xwayland_eavesdropping = comp_config
|
||||||
.get("xwayland_eavesdropping")
|
.get("xwayland_eavesdropping")
|
||||||
|
|
@ -192,10 +192,13 @@ pub fn legacy_application_global_shortcuts() -> Section<crate::pages::Message> {
|
||||||
pub fn legacy_application_scaling() -> Section<crate::pages::Message> {
|
pub fn legacy_application_scaling() -> Section<crate::pages::Message> {
|
||||||
let mut descriptions = Slab::new();
|
let mut descriptions = Slab::new();
|
||||||
|
|
||||||
let system = descriptions.insert(fl!("legacy-app-scaling", "scaled-by-system"));
|
let gaming = descriptions.insert(fl!("legacy-app-scaling", "scaled-gaming"));
|
||||||
let system_desc = descriptions.insert(fl!("legacy-app-scaling", "system-description"));
|
let gaming_desc = descriptions.insert(fl!("legacy-app-scaling", "gaming-description"));
|
||||||
let native = descriptions.insert(fl!("legacy-app-scaling", "scaled-natively"));
|
let apps = descriptions.insert(fl!("legacy-app-scaling", "scaled-applications"));
|
||||||
let native_desc = descriptions.insert(fl!("legacy-app-scaling", "native-description"));
|
let apps_desc = descriptions.insert(fl!("legacy-app-scaling", "applications-description"));
|
||||||
|
let compat = descriptions.insert(fl!("legacy-app-scaling", "scaled-compatibility"));
|
||||||
|
let compat_desc = descriptions.insert(fl!("legacy-app-scaling", "compatibility-description"));
|
||||||
|
let preferred_display = descriptions.insert(fl!("legacy-app-scaling", "preferred-display"));
|
||||||
|
|
||||||
Section::default()
|
Section::default()
|
||||||
.title(fl!("legacy-app-scaling"))
|
.title(fl!("legacy-app-scaling"))
|
||||||
|
|
@ -207,9 +210,9 @@ pub fn legacy_application_scaling() -> Section<crate::pages::Message> {
|
||||||
.add(widget::settings::item_row(vec![
|
.add(widget::settings::item_row(vec![
|
||||||
widget::radio(
|
widget::radio(
|
||||||
widget::column()
|
widget::column()
|
||||||
.push(text::body(&descriptions[system]))
|
.push(text::body(&descriptions[gaming]))
|
||||||
.push(text::caption(&descriptions[system_desc])),
|
.push(text::caption(&descriptions[gaming_desc])),
|
||||||
false,
|
XwaylandDescaling::Fractional,
|
||||||
Some(page.comp_config_descale_xwayland),
|
Some(page.comp_config_descale_xwayland),
|
||||||
Message::SetXwaylandDescaling,
|
Message::SetXwaylandDescaling,
|
||||||
)
|
)
|
||||||
|
|
@ -219,9 +222,21 @@ pub fn legacy_application_scaling() -> Section<crate::pages::Message> {
|
||||||
.add(widget::settings::item_row(vec![
|
.add(widget::settings::item_row(vec![
|
||||||
widget::radio(
|
widget::radio(
|
||||||
widget::column()
|
widget::column()
|
||||||
.push(text::body(&descriptions[native]))
|
.push(text::body(&descriptions[apps]))
|
||||||
.push(text::caption(&descriptions[native_desc])),
|
.push(text::caption(&descriptions[apps_desc])),
|
||||||
true,
|
XwaylandDescaling::Enabled,
|
||||||
|
Some(page.comp_config_descale_xwayland),
|
||||||
|
Message::SetXwaylandDescaling,
|
||||||
|
)
|
||||||
|
.width(Length::Fill)
|
||||||
|
.into(),
|
||||||
|
]))
|
||||||
|
.add(widget::settings::item_row(vec![
|
||||||
|
widget::radio(
|
||||||
|
widget::column()
|
||||||
|
.push(text::body(&descriptions[compat]))
|
||||||
|
.push(text::caption(&descriptions[compat_desc])),
|
||||||
|
XwaylandDescaling::Disabled,
|
||||||
Some(page.comp_config_descale_xwayland),
|
Some(page.comp_config_descale_xwayland),
|
||||||
Message::SetXwaylandDescaling,
|
Message::SetXwaylandDescaling,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -834,10 +834,14 @@ legacy-app-global-shortcuts = Global Shortcuts in X11 Applications
|
||||||
.mouse = Mouse button events in X11 applications
|
.mouse = Mouse button events in X11 applications
|
||||||
|
|
||||||
legacy-app-scaling = X11 Window System Application Scaling
|
legacy-app-scaling = X11 Window System Application Scaling
|
||||||
.scaled-by-system = Scale all X11 Applications
|
.scaled-gaming = Optimize for gaming and full-screen apps
|
||||||
.system-description = X11 applications will appear blurry on HiDPI screens.
|
.gaming-description = X11 applications may appear slightly larger/smaller compared to Wayland apps.
|
||||||
.scaled-natively = Render X11 Applications at native resolution
|
.scaled-applications = Optimize for applications
|
||||||
.native-description = X11 applications that don't support scaling will be small when HiDPI displays are in use. Enable for games to utilize the full monitor resolution.
|
.applications-description = Games and full-screen X11 apps may not match your display resolution.
|
||||||
|
.scaled-compatibility = Maximum compatibility mode
|
||||||
|
.compatibility-description = X11 applications may appear blurry on HiDPI screens.
|
||||||
|
.preferred-display = Preferred display for games and full screen X11 applications
|
||||||
|
.no-display = <None>
|
||||||
|
|
||||||
## System
|
## System
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue