Improve about page, sort messages
This commit is contained in:
parent
efca9e7c22
commit
910dff2c90
3 changed files with 89 additions and 37 deletions
37
Cargo.lock
generated
37
Cargo.lock
generated
|
|
@ -1218,6 +1218,7 @@ dependencies = [
|
||||||
"lexical-sort",
|
"lexical-sort",
|
||||||
"libcosmic",
|
"libcosmic",
|
||||||
"log",
|
"log",
|
||||||
|
"open",
|
||||||
"palette",
|
"palette",
|
||||||
"paste",
|
"paste",
|
||||||
"ron",
|
"ron",
|
||||||
|
|
@ -3001,6 +3002,15 @@ dependencies = [
|
||||||
"windows-sys 0.48.0",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is-docker"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is-terminal"
|
name = "is-terminal"
|
||||||
version = "0.4.12"
|
version = "0.4.12"
|
||||||
|
|
@ -3012,6 +3022,16 @@ dependencies = [
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is-wsl"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
|
||||||
|
dependencies = [
|
||||||
|
"is-docker",
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.10"
|
version = "1.0.10"
|
||||||
|
|
@ -3960,6 +3980,17 @@ version = "1.19.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "open"
|
||||||
|
version = "5.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eedff767bc49d336bff300224f73307ae36963c843e38dc9312a22171b012cbc"
|
||||||
|
dependencies = [
|
||||||
|
"is-wsl",
|
||||||
|
"libc",
|
||||||
|
"pathdiff",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "option-ext"
|
name = "option-ext"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
@ -4133,6 +4164,12 @@ version = "1.0.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pathdiff"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "percent-encoding"
|
name = "percent-encoding"
|
||||||
version = "2.3.1"
|
version = "2.3.1"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ indexmap = "2"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
lexical-sort = "0.3.1"
|
lexical-sort = "0.3.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
open = "5.0.2"
|
||||||
palette = { version = "0.7", features = ["serde"] }
|
palette = { version = "0.7", features = ["serde"] }
|
||||||
paste = "1.0"
|
paste = "1.0"
|
||||||
ron = "0.8"
|
ron = "0.8"
|
||||||
|
|
|
||||||
88
src/main.rs
88
src/main.rs
|
|
@ -258,38 +258,40 @@ pub enum Message {
|
||||||
AppTheme(AppTheme),
|
AppTheme(AppTheme),
|
||||||
ColorSchemeCollapse,
|
ColorSchemeCollapse,
|
||||||
ColorSchemeDelete(ColorSchemeKind, ColorSchemeId),
|
ColorSchemeDelete(ColorSchemeKind, ColorSchemeId),
|
||||||
|
ColorSchemeExpand(ColorSchemeKind, ColorSchemeId),
|
||||||
ColorSchemeExport(ColorSchemeKind, ColorSchemeId),
|
ColorSchemeExport(ColorSchemeKind, ColorSchemeId),
|
||||||
ColorSchemeExportResult(ColorSchemeKind, ColorSchemeId, DialogResult),
|
ColorSchemeExportResult(ColorSchemeKind, ColorSchemeId, DialogResult),
|
||||||
ColorSchemeExpand(ColorSchemeKind, ColorSchemeId),
|
|
||||||
ColorSchemeRename(ColorSchemeKind, ColorSchemeId, String),
|
|
||||||
ColorSchemeRenameSubmit,
|
|
||||||
ColorSchemeImport(ColorSchemeKind),
|
ColorSchemeImport(ColorSchemeKind),
|
||||||
ColorSchemeImportResult(ColorSchemeKind, DialogResult),
|
ColorSchemeImportResult(ColorSchemeKind, DialogResult),
|
||||||
|
ColorSchemeRename(ColorSchemeKind, ColorSchemeId, String),
|
||||||
|
ColorSchemeRenameSubmit,
|
||||||
ColorSchemeTabActivate(widget::segmented_button::Entity),
|
ColorSchemeTabActivate(widget::segmented_button::Entity),
|
||||||
Config(Config),
|
Config(Config),
|
||||||
Copy(Option<segmented_button::Entity>),
|
Copy(Option<segmented_button::Entity>),
|
||||||
|
DefaultBoldFontWeight(usize),
|
||||||
|
DefaultDimFontWeight(usize),
|
||||||
DefaultFont(usize),
|
DefaultFont(usize),
|
||||||
DefaultFontSize(usize),
|
DefaultFontSize(usize),
|
||||||
DefaultFontStretch(usize),
|
DefaultFontStretch(usize),
|
||||||
DefaultFontWeight(usize),
|
DefaultFontWeight(usize),
|
||||||
DefaultDimFontWeight(usize),
|
|
||||||
DefaultBoldFontWeight(usize),
|
|
||||||
DefaultZoomStep(usize),
|
DefaultZoomStep(usize),
|
||||||
DialogMessage(DialogMessage),
|
DialogMessage(DialogMessage),
|
||||||
Key(Modifiers, Key),
|
|
||||||
Find(bool),
|
Find(bool),
|
||||||
FindNext,
|
FindNext,
|
||||||
FindPrevious,
|
FindPrevious,
|
||||||
FindSearchValueChanged(String),
|
FindSearchValueChanged(String),
|
||||||
PaneClicked(pane_grid::Pane),
|
FocusFollowMouse(bool),
|
||||||
PaneSplit(pane_grid::Axis),
|
Key(Modifiers, Key),
|
||||||
PaneToggleMaximized,
|
LaunchUrl(String),
|
||||||
PaneFocusAdjacent(pane_grid::Direction),
|
|
||||||
PaneDragged(pane_grid::DragEvent),
|
|
||||||
PaneResized(pane_grid::ResizeEvent),
|
|
||||||
Modifiers(Modifiers),
|
Modifiers(Modifiers),
|
||||||
MouseEnter(pane_grid::Pane),
|
MouseEnter(pane_grid::Pane),
|
||||||
Opacity(u8),
|
Opacity(u8),
|
||||||
|
PaneClicked(pane_grid::Pane),
|
||||||
|
PaneDragged(pane_grid::DragEvent),
|
||||||
|
PaneFocusAdjacent(pane_grid::Direction),
|
||||||
|
PaneResized(pane_grid::ResizeEvent),
|
||||||
|
PaneSplit(pane_grid::Axis),
|
||||||
|
PaneToggleMaximized,
|
||||||
Paste(Option<segmented_button::Entity>),
|
Paste(Option<segmented_button::Entity>),
|
||||||
PasteValue(Option<segmented_button::Entity>, String),
|
PasteValue(Option<segmented_button::Entity>, String),
|
||||||
ProfileCollapse(ProfileId),
|
ProfileCollapse(ProfileId),
|
||||||
|
|
@ -302,7 +304,7 @@ pub enum Message {
|
||||||
ProfileSyntaxTheme(ProfileId, ColorSchemeKind, usize),
|
ProfileSyntaxTheme(ProfileId, ColorSchemeKind, usize),
|
||||||
ProfileTabTitle(ProfileId, String),
|
ProfileTabTitle(ProfileId, String),
|
||||||
SelectAll(Option<segmented_button::Entity>),
|
SelectAll(Option<segmented_button::Entity>),
|
||||||
UseBrightBold(bool),
|
ShowAdvancedFontSettings(bool),
|
||||||
ShowHeaderBar(bool),
|
ShowHeaderBar(bool),
|
||||||
SyntaxTheme(ColorSchemeKind, usize),
|
SyntaxTheme(ColorSchemeKind, usize),
|
||||||
SystemThemeChange,
|
SystemThemeChange,
|
||||||
|
|
@ -312,19 +314,18 @@ pub enum Message {
|
||||||
TabContextAction(segmented_button::Entity, Action),
|
TabContextAction(segmented_button::Entity, Action),
|
||||||
TabContextMenu(pane_grid::Pane, Option<Point>),
|
TabContextMenu(pane_grid::Pane, Option<Point>),
|
||||||
TabNew,
|
TabNew,
|
||||||
TabPrev,
|
|
||||||
TabNext,
|
TabNext,
|
||||||
|
TabPrev,
|
||||||
TermEvent(pane_grid::Pane, segmented_button::Entity, TermEvent),
|
TermEvent(pane_grid::Pane, segmented_button::Entity, TermEvent),
|
||||||
TermEventTx(mpsc::Sender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>),
|
TermEventTx(mpsc::Sender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>),
|
||||||
ToggleContextPage(ContextPage),
|
ToggleContextPage(ContextPage),
|
||||||
ShowAdvancedFontSettings(bool),
|
UpdateDefaultProfile((bool, ProfileId)),
|
||||||
|
UseBrightBold(bool),
|
||||||
WindowClose,
|
WindowClose,
|
||||||
WindowNew,
|
WindowNew,
|
||||||
ZoomIn,
|
ZoomIn,
|
||||||
ZoomOut,
|
ZoomOut,
|
||||||
ZoomReset,
|
ZoomReset,
|
||||||
FocusFollowMouse(bool),
|
|
||||||
UpdateDefaultProfile((bool, ProfileId)),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
|
@ -637,24 +638,31 @@ impl App {
|
||||||
|
|
||||||
fn about(&self) -> Element<Message> {
|
fn about(&self) -> Element<Message> {
|
||||||
let cosmic_theme::Spacing { space_xxs, .. } = self.core().system_theme().cosmic().spacing;
|
let cosmic_theme::Spacing { space_xxs, .. } = self.core().system_theme().cosmic().spacing;
|
||||||
|
let repository = "https://github.com/pop-os/cosmic-term";
|
||||||
|
let hash = env!("VERGEN_GIT_SHA");
|
||||||
|
let date = env!("VERGEN_GIT_COMMIT_DATE");
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::svg(widget::svg::Handle::from_memory(
|
widget::svg(widget::svg::Handle::from_memory(
|
||||||
&include_bytes!(
|
&include_bytes!(
|
||||||
"../res/icons/hicolor/256x256/apps/com.system76.CosmicTerm.svg"
|
"../res/icons/hicolor/128x128/apps/com.system76.CosmicTerm.svg"
|
||||||
)[..],
|
)[..],
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
widget::text::heading(fl!("cosmic-terminal")).into(),
|
widget::text::title3(fl!("cosmic-terminal")).into(),
|
||||||
widget::button::link("https://github.com/pop-os/cosmic-term")
|
widget::button::link(repository)
|
||||||
|
.on_press(Message::LaunchUrl(repository.to_string()))
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.into(),
|
.into(),
|
||||||
widget::text(fl!(
|
widget::button::link(fl!(
|
||||||
"git-description",
|
"git-description",
|
||||||
hash = env!("VERGEN_GIT_SHA"),
|
hash = hash,
|
||||||
date = env!("VERGEN_GIT_COMMIT_DATE")
|
date = date
|
||||||
))
|
))
|
||||||
|
.on_press(Message::LaunchUrl(format!("{}/commits/{}", repository, hash)))
|
||||||
|
.padding(0)
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
|
.align_items(Alignment::Center)
|
||||||
.spacing(space_xxs)
|
.spacing(space_xxs)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
@ -1446,9 +1454,6 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
|
|
||||||
match message {
|
match message {
|
||||||
Message::UpdateDefaultProfile((default, profile_id)) => {
|
|
||||||
config_set!(default_profile, default.then_some(profile_id));
|
|
||||||
}
|
|
||||||
Message::AppTheme(app_theme) => {
|
Message::AppTheme(app_theme) => {
|
||||||
self.config.app_theme = app_theme;
|
self.config.app_theme = app_theme;
|
||||||
return self.save_config();
|
return self.save_config();
|
||||||
|
|
@ -1730,13 +1735,6 @@ impl Application for App {
|
||||||
return dialog.update(dialog_message);
|
return dialog.update(dialog_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::Key(modifiers, key) => {
|
|
||||||
for (key_bind, action) in self.key_binds.iter() {
|
|
||||||
if key_bind.matches(modifiers, &key) {
|
|
||||||
return self.update(action.message(None));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Message::Find(find) => {
|
Message::Find(find) => {
|
||||||
self.find = find;
|
self.find = find;
|
||||||
if find {
|
if find {
|
||||||
|
|
@ -1790,6 +1788,22 @@ impl Application for App {
|
||||||
Message::FindSearchValueChanged(value) => {
|
Message::FindSearchValueChanged(value) => {
|
||||||
self.find_search_value = value;
|
self.find_search_value = value;
|
||||||
}
|
}
|
||||||
|
Message::FocusFollowMouse(focus_follow_mouse) => {
|
||||||
|
config_set!(focus_follow_mouse, focus_follow_mouse);
|
||||||
|
}
|
||||||
|
Message::Key(modifiers, key) => {
|
||||||
|
for (key_bind, action) in self.key_binds.iter() {
|
||||||
|
if key_bind.matches(modifiers, &key) {
|
||||||
|
return self.update(action.message(None));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Message::LaunchUrl(url) => match open::that_detached(&url) {
|
||||||
|
Ok(()) => {}
|
||||||
|
Err(err) => {
|
||||||
|
log::warn!("failed to open {:?}: {}", url, err);
|
||||||
|
}
|
||||||
|
},
|
||||||
Message::Modifiers(modifiers) => {
|
Message::Modifiers(modifiers) => {
|
||||||
self.modifiers = modifiers;
|
self.modifiers = modifiers;
|
||||||
}
|
}
|
||||||
|
|
@ -1962,8 +1976,8 @@ impl Application for App {
|
||||||
return self.save_config();
|
return self.save_config();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::FocusFollowMouse(focus_follow_mouse) => {
|
Message::ShowAdvancedFontSettings(show) => {
|
||||||
config_set!(focus_follow_mouse, focus_follow_mouse);
|
self.show_advanced_font_settings = show;
|
||||||
}
|
}
|
||||||
Message::SystemThemeChange => {
|
Message::SystemThemeChange => {
|
||||||
return self.update_config();
|
return self.update_config();
|
||||||
|
|
@ -2262,8 +2276,8 @@ impl Application for App {
|
||||||
|
|
||||||
self.set_context_title(context_page.title());
|
self.set_context_title(context_page.title());
|
||||||
}
|
}
|
||||||
Message::ShowAdvancedFontSettings(show) => {
|
Message::UpdateDefaultProfile((default, profile_id)) => {
|
||||||
self.show_advanced_font_settings = show;
|
config_set!(default_profile, default.then_some(profile_id));
|
||||||
}
|
}
|
||||||
Message::WindowClose => {
|
Message::WindowClose => {
|
||||||
return window::close(window::Id::MAIN);
|
return window::close(window::Id::MAIN);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue