fix(touchpad): update page to match design
This commit is contained in:
parent
ddbdc6251b
commit
852f554763
7 changed files with 117 additions and 79 deletions
|
|
@ -57,8 +57,8 @@ impl page::AutoBind<crate::pages::Message> for Page {
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
ShowMinimizeButton(bool),
|
|
||||||
ShowMaximizeButton(bool),
|
ShowMaximizeButton(bool),
|
||||||
|
ShowMinimizeButton(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Page {
|
impl Page {
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,8 @@ pub fn super_key_action() -> Section<crate::pages::Message> {
|
||||||
pub fn window_controls() -> Section<crate::pages::Message> {
|
pub fn window_controls() -> Section<crate::pages::Message> {
|
||||||
let mut descriptions = Slab::new();
|
let mut descriptions = Slab::new();
|
||||||
|
|
||||||
let minimize = descriptions.insert(fl!("window-controls", "minimize"));
|
|
||||||
let maximize = descriptions.insert(fl!("window-controls", "maximize"));
|
let maximize = descriptions.insert(fl!("window-controls", "maximize"));
|
||||||
|
let minimize = descriptions.insert(fl!("window-controls", "minimize"));
|
||||||
|
|
||||||
Section::default()
|
Section::default()
|
||||||
.title(fl!("window-controls"))
|
.title(fl!("window-controls"))
|
||||||
|
|
@ -120,14 +120,6 @@ pub fn window_controls() -> Section<crate::pages::Message> {
|
||||||
let descriptions = §ion.descriptions;
|
let descriptions = §ion.descriptions;
|
||||||
|
|
||||||
settings::view_section(§ion.title)
|
settings::view_section(§ion.title)
|
||||||
.add(settings::item(
|
|
||||||
&descriptions[minimize],
|
|
||||||
toggler(
|
|
||||||
None,
|
|
||||||
desktop.cosmic_tk.show_minimize,
|
|
||||||
super::Message::ShowMinimizeButton,
|
|
||||||
),
|
|
||||||
))
|
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
&descriptions[maximize],
|
&descriptions[maximize],
|
||||||
toggler(
|
toggler(
|
||||||
|
|
@ -136,6 +128,14 @@ pub fn window_controls() -> Section<crate::pages::Message> {
|
||||||
super::Message::ShowMaximizeButton,
|
super::Message::ShowMaximizeButton,
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
|
.add(settings::item(
|
||||||
|
&descriptions[minimize],
|
||||||
|
toggler(
|
||||||
|
None,
|
||||||
|
desktop.cosmic_tk.show_minimize,
|
||||||
|
super::Message::ShowMinimizeButton,
|
||||||
|
),
|
||||||
|
))
|
||||||
.apply(Element::from)
|
.apply(Element::from)
|
||||||
.map(crate::pages::Message::Desktop)
|
.map(crate::pages::Message::Desktop)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,36 @@
|
||||||
|
use cosmic::cosmic_config::ConfigGet;
|
||||||
use cosmic::iced::{Alignment, Length};
|
use cosmic::iced::{Alignment, Length};
|
||||||
use cosmic::widget::{self, row, settings, text};
|
use cosmic::widget::{self, row, settings, text};
|
||||||
use cosmic::{Apply, Element};
|
use cosmic::{Apply, Element};
|
||||||
use cosmic_comp_config::input::{AccelProfile, ClickMethod, ScrollMethod};
|
use cosmic_comp_config::input::{AccelProfile, ClickMethod, ScrollMethod};
|
||||||
|
use cosmic_comp_config::workspace::{WorkspaceConfig, WorkspaceLayout};
|
||||||
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;
|
||||||
use slotmap::SlotMap;
|
use slotmap::SlotMap;
|
||||||
|
use tracing::error;
|
||||||
|
|
||||||
use super::Message;
|
use super::Message;
|
||||||
|
|
||||||
#[derive(Default)]
|
pub struct Page {
|
||||||
pub struct Page;
|
comp_workspace_config: WorkspaceConfig,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Page {
|
||||||
|
fn default() -> Self {
|
||||||
|
let comp_config = cosmic_config::Config::new("com.system76.CosmicComp", 1).unwrap();
|
||||||
|
let comp_workspace_config = comp_config.get("workspaces").unwrap_or_else(|err| {
|
||||||
|
if !matches!(err, cosmic_config::Error::NoConfigDirectory) {
|
||||||
|
error!(?err, "Failed to read config 'workspaces'");
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkspaceConfig::default()
|
||||||
|
});
|
||||||
|
Self {
|
||||||
|
comp_workspace_config,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl page::Page<crate::pages::Message> for Page {
|
impl page::Page<crate::pages::Message> for Page {
|
||||||
fn content(
|
fn content(
|
||||||
|
|
@ -21,7 +41,7 @@ impl page::Page<crate::pages::Message> for Page {
|
||||||
sections.insert(touchpad()),
|
sections.insert(touchpad()),
|
||||||
sections.insert(click_behavior()),
|
sections.insert(click_behavior()),
|
||||||
sections.insert(scrolling()),
|
sections.insert(scrolling()),
|
||||||
sections.insert(swiping()),
|
sections.insert(gestures()),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,6 +58,7 @@ fn touchpad() -> Section<crate::pages::Message> {
|
||||||
let mut descriptions = Slab::new();
|
let mut descriptions = Slab::new();
|
||||||
|
|
||||||
let primary_button = descriptions.insert(fl!("primary-button"));
|
let primary_button = descriptions.insert(fl!("primary-button"));
|
||||||
|
let primary_button_desc = descriptions.insert(fl!("primary-button", "desc"));
|
||||||
let touchpad_speed = descriptions.insert(fl!("touchpad", "speed"));
|
let touchpad_speed = descriptions.insert(fl!("touchpad", "speed"));
|
||||||
let acceleration = descriptions.insert(fl!("touchpad", "acceleration"));
|
let acceleration = descriptions.insert(fl!("touchpad", "acceleration"));
|
||||||
let acceleration_desc = descriptions.insert(fl!("acceleration-desc"));
|
let acceleration_desc = descriptions.insert(fl!("acceleration-desc"));
|
||||||
|
|
@ -51,12 +72,17 @@ fn touchpad() -> Section<crate::pages::Message> {
|
||||||
let theme = cosmic::theme::active();
|
let theme = cosmic::theme::active();
|
||||||
|
|
||||||
settings::view_section(§ion.title)
|
settings::view_section(§ion.title)
|
||||||
.add(settings::flex_item(
|
.add(
|
||||||
&descriptions[primary_button],
|
settings::item::builder(&descriptions[primary_button])
|
||||||
cosmic::widget::segmented_control::horizontal(&input.touchpad_primary_button)
|
.description(&descriptions[primary_button_desc])
|
||||||
|
.flex_control(
|
||||||
|
cosmic::widget::segmented_control::horizontal(
|
||||||
|
&input.touchpad_primary_button,
|
||||||
|
)
|
||||||
.minimum_button_width(0)
|
.minimum_button_width(0)
|
||||||
.on_activate(|x| Message::PrimaryButtonSelected(x, true)),
|
.on_activate(|x| Message::PrimaryButtonSelected(x, true)),
|
||||||
))
|
),
|
||||||
|
)
|
||||||
.add(
|
.add(
|
||||||
settings::item::builder(&descriptions[touchpad_speed]).flex_control({
|
settings::item::builder(&descriptions[touchpad_speed]).flex_control({
|
||||||
let value = (input
|
let value = (input
|
||||||
|
|
@ -238,25 +264,27 @@ fn scrolling() -> Section<crate::pages::Message> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn swiping() -> Section<crate::pages::Message> {
|
fn gestures() -> Section<crate::pages::Message> {
|
||||||
let mut descriptions = Slab::new();
|
let mut descriptions = Slab::new();
|
||||||
|
|
||||||
let four_finger_down = descriptions.insert(fl!("gestures", "four-finger-down"));
|
// let four_finger_down = descriptions.insert(fl!("gestures", "four-finger-down"));
|
||||||
// let four_finger_left = descriptions.insert(fl!("gestures", "four-finger-left"));
|
// let four_finger_left = descriptions.insert(fl!("gestures", "four-finger-left"));
|
||||||
// let four_finger_right = descriptions.insert(fl!("gestures", "four-finger-right"));
|
// let four_finger_right = descriptions.insert(fl!("gestures", "four-finger-right"));
|
||||||
let four_finger_up = descriptions.insert(fl!("gestures", "four-finger-up"));
|
// let four_finger_up = descriptions.insert(fl!("gestures", "four-finger-up"));
|
||||||
// let three_finger_any = descriptions.insert(fl!("gestures", "three-finger-any"));
|
// let three_finger_any = descriptions.insert(fl!("gestures", "three-finger-any"));
|
||||||
|
|
||||||
|
let switch_workspaces = descriptions.insert(fl!("switch-workspaces"));
|
||||||
|
let switch_workspaces_horizontal = descriptions.insert(fl!("switch-workspaces", "horizontal"));
|
||||||
|
let switch_workspaces_vertical = descriptions.insert(fl!("switch-workspaces", "vertical"));
|
||||||
|
|
||||||
// let open_application_library = descriptions.insert(fl!("open-application-library"));
|
// let open_application_library = descriptions.insert(fl!("open-application-library"));
|
||||||
// let open_workspaces_view = descriptions.insert(fl!("open-workspaces-view"));
|
// let open_workspaces_view = descriptions.insert(fl!("open-workspaces-view"));
|
||||||
// let switch_between_windows = descriptions.insert(fl!("switch-between-windows"));
|
// let switch_between_windows = descriptions.insert(fl!("switch-between-windows"));
|
||||||
let switch_to_next_workspace = descriptions.insert(fl!("switch-to-next-workspace"));
|
|
||||||
let switch_to_prev_workspace = descriptions.insert(fl!("switch-to-prev-workspace"));
|
|
||||||
|
|
||||||
Section::default()
|
Section::default()
|
||||||
.title(fl!("gestures"))
|
.title(fl!("gestures"))
|
||||||
.descriptions(descriptions)
|
.descriptions(descriptions)
|
||||||
.view::<Page>(move |_binder, _page, section| {
|
.view::<Page>(move |_binder, page, section| {
|
||||||
let descriptions = §ion.descriptions;
|
let descriptions = §ion.descriptions;
|
||||||
|
|
||||||
settings::view_section(&*section.title)
|
settings::view_section(&*section.title)
|
||||||
|
|
@ -265,12 +293,13 @@ fn swiping() -> Section<crate::pages::Message> {
|
||||||
// .flex_control(text(&descriptions[switch_between_windows])),
|
// .flex_control(text(&descriptions[switch_between_windows])),
|
||||||
// )
|
// )
|
||||||
.add(
|
.add(
|
||||||
settings::item::builder(&descriptions[four_finger_up])
|
settings::item::builder(
|
||||||
.flex_control(text(&descriptions[switch_to_prev_workspace])),
|
&descriptions[match page.comp_workspace_config.workspace_layout {
|
||||||
|
WorkspaceLayout::Horizontal => switch_workspaces_horizontal,
|
||||||
|
WorkspaceLayout::Vertical => switch_workspaces_vertical,
|
||||||
|
}],
|
||||||
)
|
)
|
||||||
.add(
|
.flex_control(text(&descriptions[switch_workspaces])),
|
||||||
settings::item::builder(&descriptions[four_finger_down])
|
|
||||||
.flex_control(text(&descriptions[switch_to_next_workspace])),
|
|
||||||
)
|
)
|
||||||
// .add(
|
// .add(
|
||||||
// settings::item::builder(&descriptions[four_finger_left])
|
// settings::item::builder(&descriptions[four_finger_left])
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,7 @@ input-devices = Input Devices
|
||||||
.desc = Input Devices
|
.desc = Input Devices
|
||||||
|
|
||||||
primary-button = Primary button
|
primary-button = Primary button
|
||||||
|
.desc = Sets the order of physical buttons.
|
||||||
.left = Left
|
.left = Left
|
||||||
.right = Right
|
.right = Right
|
||||||
|
|
||||||
|
|
@ -510,9 +511,11 @@ gestures = Gestures
|
||||||
.four-finger-up = Four-finger swipe up
|
.four-finger-up = Four-finger swipe up
|
||||||
.three-finger-any = Three-finger swipe any direction
|
.three-finger-any = Three-finger swipe any direction
|
||||||
|
|
||||||
|
switch-workspaces = Switch workspaces
|
||||||
|
.horizontal = Four-finger swipe left/right
|
||||||
|
.vertical = Four-finger swipe up/down
|
||||||
|
|
||||||
switch-between-windows = Switch between windows
|
switch-between-windows = Switch between windows
|
||||||
switch-to-next-workspace = Switch to next workspace
|
|
||||||
switch-to-prev-workspace = Switch to prev workspace
|
|
||||||
open-application-library = Open Application Library
|
open-application-library = Open Application Library
|
||||||
open-workspaces-view = Open Workspaces Overview
|
open-workspaces-view = Open Workspaces Overview
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ style = Стил
|
||||||
.square = Четвртаст
|
.square = Четвртаст
|
||||||
|
|
||||||
# interface density left out for now
|
# interface density left out for now
|
||||||
window-management = Управљање прозорима
|
window-management-appearance = Управљање прозорима
|
||||||
.active-hint = Дебљина наговештаја активног прозора
|
.active-hint = Дебљина наговештаја активног прозора
|
||||||
.gaps = Празнине око сложених прозора
|
.gaps = Празнине око сложених прозора
|
||||||
|
|
||||||
|
|
@ -312,6 +312,7 @@ input-devices = Унос
|
||||||
.desc = Унос
|
.desc = Унос
|
||||||
|
|
||||||
primary-button = Примарно дугме
|
primary-button = Примарно дугме
|
||||||
|
.desc = Одређује редослед физичких дугмади.
|
||||||
.left = Лево
|
.left = Лево
|
||||||
.right = Десно
|
.right = Десно
|
||||||
|
|
||||||
|
|
@ -504,15 +505,17 @@ touchpad = Додирна табла
|
||||||
## Input: Gestures
|
## Input: Gestures
|
||||||
|
|
||||||
swiping = Покрети
|
swiping = Покрети
|
||||||
.four-finger-down = Превуците према доле са четири прста
|
.four-finger-down = Превуци према доле са четири прста
|
||||||
.four-finger-left = Превуците према лево са четири прста
|
.four-finger-left = Превуци према лево са четири прста
|
||||||
.four-finger-right = Превуците према десно са четири прста
|
.four-finger-right = Превуци према десно са четири прста
|
||||||
.four-finger-up = Превуците према горе са четири прста
|
.four-finger-up = Превуци према горе са четири прста
|
||||||
.three-finger-any = Превуците са три прста у било ком смеру
|
.three-finger-any = Превуци са три прста у било ком смеру
|
||||||
|
|
||||||
|
switch-workspaces = Промени радни простор
|
||||||
|
.horizontal = Превуци према лево/десно са четири прста
|
||||||
|
.vertical = Превуци према горе/доле са четири прста
|
||||||
|
|
||||||
switch-between-windows = Пребацивање између прозора
|
switch-between-windows = Пребацивање између прозора
|
||||||
switch-to-next-workspace = Пређи на следећи радни простор
|
|
||||||
switch-to-prev-workspace = Пређи на претходни радни простор
|
|
||||||
open-application-library = Отвори библиотеку апликација
|
open-application-library = Отвори библиотеку апликација
|
||||||
open-workspaces-view = Отвори преглед радних простора
|
open-workspaces-view = Отвори преглед радних простора
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ style = Stil
|
||||||
.square = Četvrtast
|
.square = Četvrtast
|
||||||
|
|
||||||
# interface density left out for now
|
# interface density left out for now
|
||||||
window-management = Upravljanje prozorima
|
window-management-appearance = Upravljanje prozorima
|
||||||
.active-hint = Debljina nagoveštaja aktivnog prozora
|
.active-hint = Debljina nagoveštaja aktivnog prozora
|
||||||
.gaps = Praznine oko složenih prozora
|
.gaps = Praznine oko složenih prozora
|
||||||
|
|
||||||
|
|
@ -312,6 +312,7 @@ input-devices = Unos
|
||||||
.desc = Unos
|
.desc = Unos
|
||||||
|
|
||||||
primary-button = Primarno dugme
|
primary-button = Primarno dugme
|
||||||
|
.desc = Određuje redosled fizičkih dugmadi.
|
||||||
.left = Levo
|
.left = Levo
|
||||||
.right = Desno
|
.right = Desno
|
||||||
|
|
||||||
|
|
@ -504,15 +505,17 @@ touchpad = Dodirna tabla
|
||||||
## Input: Gestures
|
## Input: Gestures
|
||||||
|
|
||||||
swiping = Pokreti
|
swiping = Pokreti
|
||||||
.four-finger-down = Prevucite prema dole sa četiri prsta
|
.four-finger-down = Prevuci prema dole sa četiri prsta
|
||||||
.four-finger-left = Prevucite prema levo sa četiri prsta
|
.four-finger-left = Prevuci prema levo sa četiri prsta
|
||||||
.four-finger-right = Prevucite prema desno sa četiri prsta
|
.four-finger-right = Prevuci prema desno sa četiri prsta
|
||||||
.four-finger-up = Prevucite prema gore sa četiri prsta
|
.four-finger-up = Prevuci prema gore sa četiri prsta
|
||||||
.three-finger-any = Prevucite sa tri prsta u bilo kom smeru
|
.three-finger-any = Prevuci sa tri prsta u bilo kom smeru
|
||||||
|
|
||||||
|
switch-workspaces = Promeni radni prostor
|
||||||
|
.horizontal = Prevuci prema levo/desno sa četiri prsta
|
||||||
|
.vertical = Prevuci prema gore/dole sa četiri prsta
|
||||||
|
|
||||||
switch-between-windows = Prebacivanje između prozora
|
switch-between-windows = Prebacivanje između prozora
|
||||||
switch-to-next-workspace = Pređi na sledeći radni prostor
|
|
||||||
switch-to-prev-workspace = Pređi na prethodni radni prostor
|
|
||||||
open-application-library = Otvori biblioteku aplikacija
|
open-application-library = Otvori biblioteku aplikacija
|
||||||
open-workspaces-view = Otvori pregled radnih prostora
|
open-workspaces-view = Otvori pregled radnih prostora
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue