fix: unbitrot cosmic example
This commit is contained in:
parent
36b3cfa13a
commit
3974974ebb
7 changed files with 132 additions and 123 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2022 System76 <info@system76.com>
|
// Copyright 2022 System76 <info@system76.com>
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
use cosmic::iced::{Application, Settings};
|
use cosmic::{app::Settings, iced::Limits};
|
||||||
|
|
||||||
mod window;
|
mod window;
|
||||||
use env_logger::Env;
|
use env_logger::Env;
|
||||||
|
|
@ -15,13 +15,9 @@ pub fn main() -> cosmic::iced::Result {
|
||||||
env_logger::init_from_env(env);
|
env_logger::init_from_env(env);
|
||||||
cosmic::icon_theme::set_default("Pop");
|
cosmic::icon_theme::set_default("Pop");
|
||||||
#[allow(clippy::field_reassign_with_default)]
|
#[allow(clippy::field_reassign_with_default)]
|
||||||
let settings = Settings {
|
let settings = Settings::default()
|
||||||
default_font: cosmic::font::default(),
|
.default_font(cosmic::font::default())
|
||||||
window: cosmic::iced::window::Settings {
|
.size_limits(Limits::NONE.min_width(600.).min_height(300.));
|
||||||
min_size: Some(cosmic::iced::Size::new(600., 300.)),
|
cosmic::app::run::<window::Window>(settings, ())?;
|
||||||
..cosmic::iced::window::Settings::default()
|
Ok(())
|
||||||
},
|
|
||||||
..Settings::default()
|
|
||||||
};
|
|
||||||
Window::run(settings)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
/// Copyright 2022 System76 <info@system76.com>
|
/// Copyright 2022 System76 <info@system76.com>
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
app::{command, Application, Core},
|
||||||
cosmic_theme::{
|
cosmic_theme::{
|
||||||
palette::{rgb::Rgb, Srgba},
|
palette::{rgb::Rgb, Srgba},
|
||||||
ThemeBuilder,
|
ThemeBuilder,
|
||||||
},
|
},
|
||||||
font::load_fonts,
|
|
||||||
iced::{self, Application, Length, Subscription, Task},
|
|
||||||
iced::{
|
iced::{
|
||||||
subscription,
|
self,
|
||||||
widget::{self, column, container, horizontal_space, row, text},
|
widget::{self, column, container, horizontal_space, row, text},
|
||||||
window::{self, close, drag, minimize, toggle_maximize},
|
window::{self, close, drag, minimize, toggle_maximize},
|
||||||
|
Length, Size, Subscription,
|
||||||
},
|
},
|
||||||
iced_futures::event::listen_raw,
|
iced_futures::event::listen_raw,
|
||||||
keyboard_nav,
|
keyboard_nav,
|
||||||
|
|
@ -20,7 +20,7 @@ use cosmic::{
|
||||||
button, header_bar, icon, list, nav_bar, nav_bar_toggle, scrollable, segmented_button,
|
button, header_bar, icon, list, nav_bar, nav_bar_toggle, scrollable, segmented_button,
|
||||||
settings, warning,
|
settings, warning,
|
||||||
},
|
},
|
||||||
Element,
|
ApplicationExt, Element,
|
||||||
};
|
};
|
||||||
use cosmic_time::{Instant, Timeline};
|
use cosmic_time::{Instant, Timeline};
|
||||||
use std::{
|
use std::{
|
||||||
|
|
@ -145,8 +145,8 @@ impl Default for Page {
|
||||||
static WINDOW_WIDTH: AtomicU32 = AtomicU32::new(0);
|
static WINDOW_WIDTH: AtomicU32 = AtomicU32::new(0);
|
||||||
const BREAK_POINT: u32 = 900;
|
const BREAK_POINT: u32 = 900;
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub struct Window {
|
pub struct Window {
|
||||||
|
core: Core,
|
||||||
bluetooth: bluetooth::State,
|
bluetooth: bluetooth::State,
|
||||||
debug: bool,
|
debug: bool,
|
||||||
demo: demo::State,
|
demo: demo::State,
|
||||||
|
|
@ -161,7 +161,6 @@ pub struct Window {
|
||||||
show_minimize: bool,
|
show_minimize: bool,
|
||||||
system_and_accounts: system_and_accounts::State,
|
system_and_accounts: system_and_accounts::State,
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
title: String,
|
|
||||||
show_warning: bool,
|
show_warning: bool,
|
||||||
warning_message: String,
|
warning_message: String,
|
||||||
scale_factor: f64,
|
scale_factor: f64,
|
||||||
|
|
@ -210,7 +209,6 @@ pub enum Message {
|
||||||
ToggleNavBar,
|
ToggleNavBar,
|
||||||
ToggleNavBarCondensed,
|
ToggleNavBarCondensed,
|
||||||
ToggleWarning,
|
ToggleWarning,
|
||||||
FontsLoaded,
|
|
||||||
Tick(Instant),
|
Tick(Instant),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,7 +229,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn page_title<Message: 'static>(&self, page: Page) -> Element<Message> {
|
fn page_title<Message: 'static>(&self, page: Page) -> Element<Message> {
|
||||||
row!(text(page.title()).size(28), horizontal_space(Length::Fill),).into()
|
row!(text(page.title()).size(28), horizontal_space(),).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_condensed(&self) -> bool {
|
fn is_condensed(&self) -> bool {
|
||||||
|
|
@ -253,10 +251,7 @@ impl Window {
|
||||||
.label(page.title())
|
.label(page.title())
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.on_press(Message::from(page)),
|
.on_press(Message::from(page)),
|
||||||
row!(
|
row!(text(sub_page.title()).size(28), horizontal_space(),),
|
||||||
text(sub_page.title()).size(28),
|
|
||||||
horizontal_space(Length::Fill),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
.into()
|
.into()
|
||||||
|
|
@ -281,7 +276,7 @@ impl Window {
|
||||||
)
|
)
|
||||||
.spacing(2)
|
.spacing(2)
|
||||||
.into(),
|
.into(),
|
||||||
horizontal_space(iced::Length::Fill).into(),
|
horizontal_space().into(),
|
||||||
icon::from_name("go-next-symbolic").size(20).icon().into(),
|
icon::from_name("go-next-symbolic").size(20).icon().into(),
|
||||||
])
|
])
|
||||||
.spacing(16),
|
.spacing(16),
|
||||||
|
|
@ -290,7 +285,7 @@ impl Window {
|
||||||
)
|
)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.style(theme::iced::Button::Transparent)
|
.class(theme::iced::Button::Transparent)
|
||||||
.on_press(Message::from(sub_page.into_page()))
|
.on_press(Message::from(sub_page.into_page()))
|
||||||
// .id(BTN.clone())
|
// .id(BTN.clone())
|
||||||
.into()
|
.into()
|
||||||
|
|
@ -322,17 +317,43 @@ impl Application for Window {
|
||||||
type Executor = cosmic::executor::Default;
|
type Executor = cosmic::executor::Default;
|
||||||
type Flags = ();
|
type Flags = ();
|
||||||
type Message = Message;
|
type Message = Message;
|
||||||
type Theme = Theme;
|
|
||||||
|
|
||||||
fn new(_flags: ()) -> (Self, Task<Self::Message>) {
|
/// The unique application ID to supply to the window manager.
|
||||||
let mut window = Window::default()
|
const APP_ID: &'static str = "org.cosmic.CosmicDemo";
|
||||||
.nav_bar_toggled(true)
|
|
||||||
.show_maximize(true)
|
fn core(&self) -> &Core {
|
||||||
.show_minimize(true);
|
&self.core
|
||||||
|
}
|
||||||
|
|
||||||
|
fn core_mut(&mut self) -> &mut Core {
|
||||||
|
&mut self.core
|
||||||
|
}
|
||||||
|
|
||||||
|
fn init(core: Core, _flags: ()) -> (Self, command::Task<Self::Message>) {
|
||||||
|
let mut window = Window {
|
||||||
|
core,
|
||||||
|
bluetooth: bluetooth::State::default(),
|
||||||
|
debug: false,
|
||||||
|
demo: demo::State::default(),
|
||||||
|
editor: editor::State::default(),
|
||||||
|
desktop: desktop::State::default(),
|
||||||
|
nav_bar: segmented_button::SingleSelectModel::default(),
|
||||||
|
nav_id_to_page: segmented_button::SecondaryMap::default(),
|
||||||
|
nav_bar_toggled_condensed: false,
|
||||||
|
nav_bar_toggled: true,
|
||||||
|
page: Page::default(),
|
||||||
|
show_maximize: true,
|
||||||
|
show_minimize: true,
|
||||||
|
system_and_accounts: system_and_accounts::State::default(),
|
||||||
|
theme: Theme::default(),
|
||||||
|
show_warning: false,
|
||||||
|
warning_message: String::from("You were not supposed to touch that."),
|
||||||
|
scale_factor: 1.0,
|
||||||
|
scale_factor_string: String::new(),
|
||||||
|
timeline: Rc::new(RefCell::new(Timeline::default())),
|
||||||
|
};
|
||||||
|
|
||||||
window.title = String::from("COSMIC Design System - Iced");
|
|
||||||
window.set_scale_factor(1.0);
|
window.set_scale_factor(1.0);
|
||||||
window.warning_message = String::from("You were not supposed to touch that.");
|
|
||||||
|
|
||||||
window.insert_page(Page::Demo);
|
window.insert_page(Page::Demo);
|
||||||
window.insert_page(Page::Editor);
|
window.insert_page(Page::Editor);
|
||||||
|
|
@ -352,19 +373,18 @@ impl Application for Window {
|
||||||
window.insert_page(Page::Applications);
|
window.insert_page(Page::Applications);
|
||||||
window.demo.timeline = window.timeline.clone();
|
window.demo.timeline = window.timeline.clone();
|
||||||
|
|
||||||
(window, load_fonts().map(|_| Message::FontsLoaded))
|
let command = window.set_window_title(
|
||||||
}
|
"COSMIC Design System - Iced".into(),
|
||||||
|
window.core.main_window_id().unwrap(),
|
||||||
|
);
|
||||||
|
|
||||||
fn title(&self) -> String {
|
(window, command)
|
||||||
self.title.clone()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subscription(&self) -> Subscription<Message> {
|
fn subscription(&self) -> Subscription<Message> {
|
||||||
let window_break = listen_raw(|event, _| match event {
|
let window_break = listen_raw(|event, _, _| match event {
|
||||||
cosmic::iced::Event::Window(
|
cosmic::iced::Event::Window(window::Event::Resized(Size { width, height: _ })) => {
|
||||||
_window_id,
|
let width = width as u32;
|
||||||
window::Event::Resized { width, height: _ },
|
|
||||||
) => {
|
|
||||||
let old_width = WINDOW_WIDTH.load(Ordering::Relaxed);
|
let old_width = WINDOW_WIDTH.load(Ordering::Relaxed);
|
||||||
if old_width == 0
|
if old_width == 0
|
||||||
|| old_width < BREAK_POINT && width > BREAK_POINT
|
|| old_width < BREAK_POINT && width > BREAK_POINT
|
||||||
|
|
@ -385,12 +405,12 @@ impl Application for Window {
|
||||||
self.timeline
|
self.timeline
|
||||||
.borrow()
|
.borrow()
|
||||||
.as_subscription()
|
.as_subscription()
|
||||||
.map(|(_, instant)| Self::Message::Tick(instant)),
|
.map(|(_, instant)| Message::Tick(instant)),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, message: Message) -> iced::Task<Self::Message> {
|
fn update(&mut self, message: Message) -> command::Task<Self::Message> {
|
||||||
let mut ret = Task::none();
|
let mut ret = command::Task::none();
|
||||||
match message {
|
match message {
|
||||||
Message::NavBar(key) => {
|
Message::NavBar(key) => {
|
||||||
if let Some(page) = self.nav_id_to_page.get(key).copied() {
|
if let Some(page) = self.nav_id_to_page.get(key).copied() {
|
||||||
|
|
@ -404,7 +424,10 @@ impl Application for Window {
|
||||||
}
|
}
|
||||||
Message::Demo(message) => match self.demo.update(message) {
|
Message::Demo(message) => match self.demo.update(message) {
|
||||||
Some(demo::Output::Debug(debug)) => self.debug = debug,
|
Some(demo::Output::Debug(debug)) => self.debug = debug,
|
||||||
Some(demo::Output::ScalingFactor(factor)) => self.set_scale_factor(factor),
|
Some(demo::Output::ScalingFactor(factor)) => {
|
||||||
|
self.set_scale_factor(factor);
|
||||||
|
ret = self.core.set_scaling_factor(factor);
|
||||||
|
}
|
||||||
Some(demo::Output::ThemeChanged(theme)) => {
|
Some(demo::Output::ThemeChanged(theme)) => {
|
||||||
self.theme = match theme {
|
self.theme = match theme {
|
||||||
demo::ThemeVariant::Light => Theme::light(),
|
demo::ThemeVariant::Light => Theme::light(),
|
||||||
|
|
@ -424,6 +447,7 @@ impl Application for Window {
|
||||||
)),
|
)),
|
||||||
demo::ThemeVariant::System => cosmic::theme::system_preference(),
|
demo::ThemeVariant::System => cosmic::theme::system_preference(),
|
||||||
};
|
};
|
||||||
|
ret = command::set_theme(self.theme.clone())
|
||||||
}
|
}
|
||||||
Some(demo::Output::ToggleWarning) => self.toggle_warning(),
|
Some(demo::Output::ToggleWarning) => self.toggle_warning(),
|
||||||
None => (),
|
None => (),
|
||||||
|
|
@ -451,7 +475,6 @@ impl Application for Window {
|
||||||
_ => (),
|
_ => (),
|
||||||
},
|
},
|
||||||
Message::ToggleWarning => self.toggle_warning(),
|
Message::ToggleWarning => self.toggle_warning(),
|
||||||
Message::FontsLoaded => {} // Message::Tick(instant) => self.timeline.borrow_mut().now(instant), Message::Tick(instant) => self.timeline.borrow_mut().now(instant),
|
|
||||||
Message::Tick(instant) => self.timeline.borrow_mut().now(instant),
|
Message::Tick(instant) => self.timeline.borrow_mut().now(instant),
|
||||||
}
|
}
|
||||||
ret
|
ret
|
||||||
|
|
@ -577,7 +600,7 @@ impl Application for Window {
|
||||||
.padding([0, 8, 8, 8])
|
.padding([0, 8, 8, 8])
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.style(theme::Container::Background)
|
.class(theme::Container::Background)
|
||||||
.into();
|
.into();
|
||||||
let warning = warning(&self.warning_message)
|
let warning = warning(&self.warning_message)
|
||||||
.on_close(Message::ToggleWarning)
|
.on_close(Message::ToggleWarning)
|
||||||
|
|
@ -587,22 +610,14 @@ impl Application for Window {
|
||||||
header,
|
header,
|
||||||
container(column(vec![
|
container(column(vec![
|
||||||
warning,
|
warning,
|
||||||
iced::widget::vertical_space(Length::Fixed(12.0)).into(),
|
iced::widget::Space::with_height(Length::Fixed(12.0)).into(),
|
||||||
content,
|
content,
|
||||||
]))
|
]))
|
||||||
.style(theme::Container::Background)
|
.class(theme::Container::Background)
|
||||||
]
|
]
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
column(vec![header, content]).into()
|
column(vec![header, content]).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scale_factor(&self) -> f64 {
|
|
||||||
self.scale_factor
|
|
||||||
}
|
|
||||||
|
|
||||||
fn theme(&self) -> Theme {
|
|
||||||
self.theme.clone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,14 @@ impl State {
|
||||||
column!(
|
column!(
|
||||||
list_column().add(settings::item(
|
list_column().add(settings::item(
|
||||||
"Bluetooth",
|
"Bluetooth",
|
||||||
toggler(None, self.enabled, Message::Enable)
|
toggler(self.enabled).on_toggle(Message::Enable)
|
||||||
)),
|
)),
|
||||||
text("Now visible as \"TODO\", just kidding")
|
text("Now visible as \"TODO\", just kidding")
|
||||||
)
|
)
|
||||||
.spacing(8)
|
.spacing(8)
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Devices")
|
settings::section()
|
||||||
|
.title("Devices")
|
||||||
.add(settings::item("No devices found", text("")))
|
.add(settings::item("No devices found", text("")))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -125,11 +125,12 @@ impl Default for State {
|
||||||
checkbox_value: false,
|
checkbox_value: false,
|
||||||
dropdown_selected: Some(0),
|
dropdown_selected: Some(0),
|
||||||
dropdown_options: vec!["Option 1", "Option 2", "Option 3", "Option 4"],
|
dropdown_options: vec!["Option 1", "Option 2", "Option 3", "Option 4"],
|
||||||
scaling_value: spin_button::Model::default()
|
scaling_value: spin_button::Model {
|
||||||
.value(1.0)
|
value: 1.0.into(),
|
||||||
.min(0.5)
|
min: 0.5.into(),
|
||||||
.max(2.0)
|
max: 2.0.into(),
|
||||||
.step(0.25),
|
step: 0.25.into(),
|
||||||
|
},
|
||||||
slider_value: 50.0,
|
slider_value: 50.0,
|
||||||
spin_button: spin_button::Model::default().min(-10).max(10),
|
spin_button: spin_button::Model::default().min(-10).max(10),
|
||||||
toggler_value: false,
|
toggler_value: false,
|
||||||
|
|
@ -232,7 +233,7 @@ impl State {
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.fold(
|
.fold(
|
||||||
column![].spacing(10).align_items(Alignment::Center),
|
column![].spacing(10).align_x(Alignment::Center),
|
||||||
|row, theme| {
|
|row, theme| {
|
||||||
row.push(radio(
|
row.push(radio(
|
||||||
format!("{:?}", theme),
|
format!("{:?}", theme),
|
||||||
|
|
@ -258,12 +259,13 @@ impl State {
|
||||||
match self.tab_bar.active_data() {
|
match self.tab_bar.active_data() {
|
||||||
None => panic!("no tab is active"),
|
None => panic!("no tab is active"),
|
||||||
Some(DemoView::TabA) => settings::view_column(vec![
|
Some(DemoView::TabA) => settings::view_column(vec![
|
||||||
settings::view_section("Debug")
|
settings::section()
|
||||||
|
.title("Debug")
|
||||||
.add(settings::item("Debug theme", choose_theme))
|
.add(settings::item("Debug theme", choose_theme))
|
||||||
.add(settings::item("Debug icon theme", choose_icon_theme))
|
.add(settings::item("Debug icon theme", choose_icon_theme))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Debug layout",
|
"Debug layout",
|
||||||
toggler(None, window.debug, Message::Debug),
|
toggler(window.debug).on_toggle(Message::Debug),
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Scaling Factor",
|
"Scaling Factor",
|
||||||
|
|
@ -276,10 +278,11 @@ impl State {
|
||||||
.into(),
|
.into(),
|
||||||
]))
|
]))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Controls")
|
settings::section()
|
||||||
|
.title("Controls")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Toggler",
|
"Toggler",
|
||||||
toggler(None, self.toggler_value, Message::TogglerToggled),
|
toggler(self.toggler_value).on_toggle(Message::TogglerToggled),
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Pick List (TODO)",
|
"Pick List (TODO)",
|
||||||
|
|
@ -305,8 +308,8 @@ impl State {
|
||||||
.add(settings::item_row(vec![checkbox(
|
.add(settings::item_row(vec![checkbox(
|
||||||
"Checkbox",
|
"Checkbox",
|
||||||
self.checkbox_value,
|
self.checkbox_value,
|
||||||
Message::CheckboxToggled,
|
|
||||||
)
|
)
|
||||||
|
.on_toggle(Message::CheckboxToggled)
|
||||||
.into()]))
|
.into()]))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
format!(
|
format!(
|
||||||
|
|
@ -354,7 +357,7 @@ impl State {
|
||||||
.width(Length::Shrink)
|
.width(Length::Shrink)
|
||||||
.on_activate(Message::MultiSelection)
|
.on_activate(Message::MultiSelection)
|
||||||
.apply(container)
|
.apply(container)
|
||||||
.center_x()
|
.center_x(Length::Fill)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.into(),
|
.into(),
|
||||||
text("Vertical With Spacing").into(),
|
text("Vertical With Spacing").into(),
|
||||||
|
|
@ -424,13 +427,12 @@ impl State {
|
||||||
])
|
])
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.into(),
|
.into(),
|
||||||
Some(DemoView::TabC) => {
|
Some(DemoView::TabC) => settings::view_column(vec![settings::section()
|
||||||
settings::view_column(vec![settings::view_section("Tab C")
|
.title("Tab C")
|
||||||
.add(text("Nothing here yet").width(Length::Fill))
|
.add(text("Nothing here yet").width(Length::Fill))
|
||||||
.into()])
|
.into()])
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.into()
|
.into(),
|
||||||
}
|
|
||||||
},
|
},
|
||||||
container(text("Background container with some text").size(24))
|
container(text("Background container with some text").size(24))
|
||||||
.layer(cosmic_theme::Layer::Background)
|
.layer(cosmic_theme::Layer::Background)
|
||||||
|
|
|
||||||
|
|
@ -147,46 +147,40 @@ impl State {
|
||||||
fn view_desktop_options<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
fn view_desktop_options<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
||||||
settings::view_column(vec![
|
settings::view_column(vec![
|
||||||
window.parent_page_button(DesktopPage::DesktopOptions),
|
window.parent_page_button(DesktopPage::DesktopOptions),
|
||||||
settings::view_section("Super Key Action")
|
settings::section()
|
||||||
.add(settings::item("Launcher", horizontal_space(Length::Fill)))
|
.title("Super Key Action")
|
||||||
.add(settings::item("Workspaces", horizontal_space(Length::Fill)))
|
.add(settings::item("Launcher", horizontal_space()))
|
||||||
.add(settings::item(
|
.add(settings::item("Workspaces", horizontal_space()))
|
||||||
"Applications",
|
.add(settings::item("Applications", horizontal_space()))
|
||||||
horizontal_space(Length::Fill),
|
|
||||||
))
|
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Hot Corner")
|
settings::section()
|
||||||
|
.title("Hot Corner")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Enable top-left hot corner for Workspaces",
|
"Enable top-left hot corner for Workspaces",
|
||||||
toggler(None, self.top_left_hot_corner, Message::TopLeftHotCorner),
|
toggler(self.top_left_hot_corner).on_toggle(Message::TopLeftHotCorner),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Top Panel")
|
settings::section()
|
||||||
|
.title("Top Panel")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Show Workspaces Button",
|
"Show Workspaces Button",
|
||||||
toggler(
|
toggler(self.show_workspaces_button).on_toggle(Message::ShowWorkspacesButton),
|
||||||
None,
|
|
||||||
self.show_workspaces_button,
|
|
||||||
Message::ShowWorkspacesButton,
|
|
||||||
),
|
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Show Applications Button",
|
"Show Applications Button",
|
||||||
toggler(
|
toggler(self.show_applications_button)
|
||||||
None,
|
.on_toggle(Message::ShowApplicationsButton),
|
||||||
self.show_applications_button,
|
|
||||||
Message::ShowApplicationsButton,
|
|
||||||
),
|
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Window Controls")
|
settings::section()
|
||||||
|
.title("Window Controls")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Show Minimize Button",
|
"Show Minimize Button",
|
||||||
toggler(None, self.show_minimize_button, Message::ShowMinimizeButton),
|
toggler(self.show_minimize_button).on_toggle(Message::ShowMinimizeButton),
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Show Maximize Button",
|
"Show Maximize Button",
|
||||||
toggler(None, self.show_maximize_button, Message::ShowMaximizeButton),
|
toggler(self.show_maximize_button).on_toggle(Message::ShowMaximizeButton),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
@ -232,25 +226,25 @@ impl State {
|
||||||
settings::view_column(vec![
|
settings::view_column(vec![
|
||||||
window.parent_page_button(DesktopPage::Wallpaper),
|
window.parent_page_button(DesktopPage::Wallpaper),
|
||||||
row!(
|
row!(
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(),
|
||||||
container(
|
container(
|
||||||
image("/usr/share/backgrounds/pop/kate-hazen-COSMIC-desktop-wallpaper.png")
|
image("/usr/share/backgrounds/pop/kate-hazen-COSMIC-desktop-wallpaper.png")
|
||||||
.width(Length::Fixed(300.0))
|
.width(Length::Fixed(300.0))
|
||||||
)
|
)
|
||||||
.padding(4)
|
.padding(4)
|
||||||
.style(theme::Container::Background),
|
.class(theme::Container::Background),
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(),
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
list_column()
|
list_column()
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Same background on all displays",
|
"Same background on all displays",
|
||||||
toggler(None, self.same_background, Message::SameBackground),
|
toggler(self.same_background).on_toggle(Message::SameBackground),
|
||||||
))
|
))
|
||||||
.add(settings::item("Background fit", text("TODO")))
|
.add(settings::item("Background fit", text("TODO")))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Slideshow",
|
"Slideshow",
|
||||||
toggler(None, self.slideshow, Message::Slideshow),
|
toggler(self.slideshow).on_toggle(Message::Slideshow),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
column(image_column).spacing(16).into(),
|
column(image_column).spacing(16).into(),
|
||||||
|
|
@ -261,24 +255,23 @@ impl State {
|
||||||
fn view_desktop_workspaces<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
fn view_desktop_workspaces<'a>(&'a self, window: &'a Window) -> Element<'a, Message> {
|
||||||
settings::view_column(vec![
|
settings::view_column(vec![
|
||||||
window.parent_page_button(DesktopPage::Wallpaper),
|
window.parent_page_button(DesktopPage::Wallpaper),
|
||||||
settings::view_section("Workspace Behavior")
|
settings::section()
|
||||||
.add(settings::item(
|
.title("Workspace Behavior")
|
||||||
"Dynamic workspaces",
|
.add(settings::item("Dynamic workspaces", horizontal_space()))
|
||||||
horizontal_space(Length::Fill),
|
|
||||||
))
|
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Fixed Number of Workspaces",
|
"Fixed Number of Workspaces",
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Multi-monitor Behavior")
|
settings::section()
|
||||||
|
.title("Multi-monitor Behavior")
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Workspaces Span Displays",
|
"Workspaces Span Displays",
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(),
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Displays Have Separate Workspaces",
|
"Displays Have Separate Workspaces",
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(),
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ impl State {
|
||||||
.apply(button::icon)
|
.apply(button::icon)
|
||||||
.on_press(Message::AddNew);
|
.on_press(Message::AddNew);
|
||||||
|
|
||||||
let tab_header = row!(tabs, new_tab_button).align_items(Alignment::Center);
|
let tab_header = row!(tabs, new_tab_button).align_y(Alignment::Center);
|
||||||
|
|
||||||
row!(tab_header, horizontal_space(Length::Fill)).into()
|
row!(tab_header, horizontal_space()).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
iced::widget::{horizontal_space, row, text},
|
iced::widget::{horizontal_space, row, text},
|
||||||
iced::Length,
|
|
||||||
widget::{icon, list_column, settings},
|
widget::{icon, list_column, settings},
|
||||||
Element,
|
Element,
|
||||||
};
|
};
|
||||||
|
|
@ -61,22 +60,24 @@ impl State {
|
||||||
settings::view_column(vec![
|
settings::view_column(vec![
|
||||||
window.parent_page_button(SystemAndAccountsPage::About),
|
window.parent_page_button(SystemAndAccountsPage::About),
|
||||||
row!(
|
row!(
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(),
|
||||||
icon::from_name("distributor-logo").size(78).icon(),
|
icon::from_name("distributor-logo").size(78).icon(),
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(),
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
list_column()
|
list_column()
|
||||||
.add(settings::item("Device name", text("TODO")))
|
.add(settings::item("Device name", text("TODO")))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Hardware")
|
settings::section()
|
||||||
|
.title("Hardware")
|
||||||
.add(settings::item("Hardware model", text("TODO")))
|
.add(settings::item("Hardware model", text("TODO")))
|
||||||
.add(settings::item("Memory", text("TODO")))
|
.add(settings::item("Memory", text("TODO")))
|
||||||
.add(settings::item("Processor", text("TODO")))
|
.add(settings::item("Processor", text("TODO")))
|
||||||
.add(settings::item("Graphics", text("TODO")))
|
.add(settings::item("Graphics", text("TODO")))
|
||||||
.add(settings::item("Disk Capacity", text("TODO")))
|
.add(settings::item("Disk Capacity", text("TODO")))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Operating System")
|
settings::section()
|
||||||
|
.title("Operating System")
|
||||||
.add(settings::item("Operating system", text("TODO")))
|
.add(settings::item("Operating system", text("TODO")))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Operating system architecture",
|
"Operating system architecture",
|
||||||
|
|
@ -85,7 +86,8 @@ impl State {
|
||||||
.add(settings::item("Desktop environment", text("TODO")))
|
.add(settings::item("Desktop environment", text("TODO")))
|
||||||
.add(settings::item("Windowing system", text("TODO")))
|
.add(settings::item("Windowing system", text("TODO")))
|
||||||
.into(),
|
.into(),
|
||||||
settings::view_section("Related settings")
|
settings::section()
|
||||||
|
.title("Related settings")
|
||||||
.add(settings::item("Get support", text("TODO")))
|
.add(settings::item("Get support", text("TODO")))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue