feat: add SSD support via config option
This commit is contained in:
parent
3e78eb2381
commit
9929fbbfdb
5 changed files with 42 additions and 15 deletions
|
|
@ -391,7 +391,7 @@ where
|
|||
pub fn style(&self, theme: &Theme) -> iced_runtime::Appearance {
|
||||
if let Some(style) = self.app.style() {
|
||||
style
|
||||
} else if self.app.core().window.is_maximized {
|
||||
} else if self.app.core().window.is_maximized || !self.app.core().window.client_decorations {
|
||||
let theme = THEME.lock().unwrap();
|
||||
crate::style::iced::application::appearance(theme.borrow())
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,14 @@ pub(crate) fn iced_settings<App: Application>(
|
|||
window_settings.resize_border = border_size as u32;
|
||||
window_settings.resizable = true;
|
||||
}
|
||||
window_settings.decorations = !settings.client_decorations;
|
||||
|
||||
core.window.client_decorations = if cfg!(any(target_os = "windows", target_os = "macos")) {
|
||||
settings.client_decorations || crate::config::client_decorations()
|
||||
} else {
|
||||
settings.client_decorations && crate::config::client_decorations()
|
||||
};
|
||||
window_settings.decorations = !core.window.client_decorations;
|
||||
|
||||
window_settings.size = settings.size;
|
||||
let min_size = settings.size_limits.min();
|
||||
if min_size != iced::Size::ZERO {
|
||||
|
|
@ -549,7 +556,7 @@ impl<App: Application> ApplicationExt for App {
|
|||
fn view_main(&self) -> Element<'_, crate::Action<Self::Message>> {
|
||||
let core = self.core();
|
||||
let is_condensed = core.is_condensed();
|
||||
let sharp_corners = core.window.sharp_corners;
|
||||
let sharp_corners = core.window.sharp_corners || !core.window.client_decorations;
|
||||
let maximized = core.window.is_maximized;
|
||||
let content_container = core.window.content_container;
|
||||
let show_context = core.window.show_context;
|
||||
|
|
@ -713,7 +720,6 @@ impl<App: Application> ApplicationExt for App {
|
|||
.maximized(maximized)
|
||||
.sharp_corners(sharp_corners)
|
||||
.transparent(content_container)
|
||||
.title(&core.window.header_title)
|
||||
.on_drag(crate::Action::Cosmic(Action::Drag))
|
||||
.on_right_click(crate::Action::Cosmic(Action::ShowWindowMenu))
|
||||
.on_double_click(crate::Action::Cosmic(Action::Maximize))
|
||||
|
|
@ -731,19 +737,23 @@ impl<App: Application> ApplicationExt for App {
|
|||
|
||||
header = header.start(toggle);
|
||||
}
|
||||
if core.window.client_decorations {
|
||||
header = header.title(&core.window.header_title);
|
||||
|
||||
if core.window.show_close {
|
||||
header = header.on_close(crate::Action::Cosmic(Action::Close));
|
||||
}
|
||||
|
||||
if core.window.show_maximize && crate::config::show_maximize() {
|
||||
header = header.on_maximize(crate::Action::Cosmic(Action::Maximize));
|
||||
}
|
||||
|
||||
if core.window.show_minimize && crate::config::show_minimize() {
|
||||
header = header.on_minimize(crate::Action::Cosmic(Action::Minimize));
|
||||
}
|
||||
|
||||
if core.window.show_close {
|
||||
header = header.on_close(crate::Action::Cosmic(Action::Close));
|
||||
}
|
||||
|
||||
if core.window.show_maximize && crate::config::show_maximize() {
|
||||
header = header.on_maximize(crate::Action::Cosmic(Action::Maximize));
|
||||
}
|
||||
|
||||
if core.window.show_minimize && crate::config::show_minimize() {
|
||||
header = header.on_minimize(crate::Action::Cosmic(Action::Minimize));
|
||||
}
|
||||
|
||||
|
||||
for element in self.header_start() {
|
||||
header = header.start(element.map(crate::Action::App));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,9 @@ impl Default for Settings {
|
|||
#[cfg(feature = "wayland")]
|
||||
autosize: false,
|
||||
no_main_window: false,
|
||||
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||
client_decorations: false,
|
||||
#[cfg(target_os = "linux")]
|
||||
client_decorations: true,
|
||||
debug: false,
|
||||
default_font: font::default(),
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ pub fn apply_theme_global() -> bool {
|
|||
COSMIC_TK.read().unwrap().apply_theme_global
|
||||
}
|
||||
|
||||
/// Enable client-side decorations.
|
||||
pub fn client_decorations() -> bool {
|
||||
COSMIC_TK.read().unwrap().client_decorations
|
||||
}
|
||||
|
||||
/// Show minimize button in window header.
|
||||
#[allow(clippy::missing_panics_doc)]
|
||||
pub fn show_minimize() -> bool {
|
||||
|
|
@ -98,6 +103,9 @@ pub struct CosmicTk {
|
|||
/// Show maximize button in window header.
|
||||
pub show_maximize: bool,
|
||||
|
||||
/// Enables client-side decorations.
|
||||
pub client_decorations: bool,
|
||||
|
||||
/// Preferred icon theme.
|
||||
pub icon_theme: String,
|
||||
|
||||
|
|
@ -120,6 +128,10 @@ impl Default for CosmicTk {
|
|||
apply_theme_global: false,
|
||||
show_minimize: true,
|
||||
show_maximize: true,
|
||||
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||
client_decorations: false,
|
||||
#[cfg(target_os = "linux")]
|
||||
client_decorations: true,
|
||||
icon_theme: String::from("Cosmic"),
|
||||
header_size: Density::Standard,
|
||||
interface_density: Density::Standard,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ pub struct Window {
|
|||
pub show_maximize: bool,
|
||||
pub show_minimize: bool,
|
||||
pub is_maximized: bool,
|
||||
pub client_decorations: bool,
|
||||
height: f32,
|
||||
width: f32,
|
||||
}
|
||||
|
|
@ -143,6 +144,7 @@ impl Default for Core {
|
|||
show_minimize: true,
|
||||
show_window_menu: false,
|
||||
is_maximized: false,
|
||||
client_decorations: true,
|
||||
height: 0.,
|
||||
width: 0.,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue