Add about page
This commit is contained in:
parent
6c6ceaa853
commit
c9f99a3025
7 changed files with 140 additions and 5 deletions
88
Cargo.lock
generated
88
Cargo.lock
generated
|
|
@ -281,6 +281,12 @@ version = "0.1.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e"
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.80"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
|
||||
|
||||
[[package]]
|
||||
name = "apply"
|
||||
version = "0.3.0"
|
||||
|
|
@ -1220,6 +1226,7 @@ dependencies = [
|
|||
"shlex",
|
||||
"smol_str",
|
||||
"tokio",
|
||||
"vergen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1495,6 +1502,15 @@ dependencies = [
|
|||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
|
||||
dependencies = [
|
||||
"powerfmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derivative"
|
||||
version = "2.2.0"
|
||||
|
|
@ -3775,6 +3791,12 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.46"
|
||||
|
|
@ -3880,6 +3902,15 @@ dependencies = [
|
|||
"syn 2.0.51",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_threads"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc"
|
||||
version = "0.2.7"
|
||||
|
|
@ -4283,6 +4314,12 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "powerfmt"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
|
|
@ -4783,6 +4820,12 @@ dependencies = [
|
|||
"owned_ttf_parser 0.15.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
|
||||
|
||||
[[package]]
|
||||
name = "rustybuzz"
|
||||
version = "0.12.1"
|
||||
|
|
@ -5319,6 +5362,39 @@ dependencies = [
|
|||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa",
|
||||
"libc",
|
||||
"num-conv",
|
||||
"num_threads",
|
||||
"powerfmt",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
|
||||
dependencies = [
|
||||
"num-conv",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiny-keccak"
|
||||
version = "2.0.2"
|
||||
|
|
@ -5740,6 +5816,18 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "vergen"
|
||||
version = "8.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cfg-if 1.0.0",
|
||||
"rustversion",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "version-compare"
|
||||
version = "0.1.1"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
rust-version = "1.71"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[build-dependencies]
|
||||
vergen = { version = "8", features = ["git", "gitcl"] }
|
||||
|
||||
[dependencies]
|
||||
alacritty_terminal = "0.20"
|
||||
|
|
|
|||
8
build.rs
Normal file
8
build.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
vergen::EmitBuilder::builder()
|
||||
.fail_on_error()
|
||||
.git_commit_date()
|
||||
.git_sha(true)
|
||||
.emit()?;
|
||||
Ok(())
|
||||
}
|
||||
3
debian/control
vendored
3
debian/control
vendored
|
|
@ -4,6 +4,7 @@ Priority: optional
|
|||
Maintainer: Jeremy Soller <jeremy@system76.com>
|
||||
Build-Depends:
|
||||
debhelper-compat (=13),
|
||||
git,
|
||||
just (>= 1.13.0),
|
||||
pkg-config,
|
||||
rust-all,
|
||||
|
|
@ -14,4 +15,4 @@ Package: cosmic-term
|
|||
Architecture: amd64 arm64
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Provides: x-terminal-emulator
|
||||
Description: Cosmic Terminal
|
||||
Description: COSMIC Terminal
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
cosmic-terminal = COSMIC Terminal
|
||||
new-terminal = New terminal
|
||||
|
||||
# Context Pages
|
||||
|
||||
## About
|
||||
about = About
|
||||
git-description = Git commit {$hash} on {$date}
|
||||
|
||||
## Color schemes
|
||||
color-schemes = Color schemes
|
||||
rename = Rename
|
||||
|
|
@ -89,3 +94,4 @@ split-vertical = Split vertical
|
|||
pane-toggle-maximize = Toggle maximized
|
||||
menu-color-schemes = Color schemes...
|
||||
menu-settings = Settings...
|
||||
menu-about = About COSMIC Terminal...
|
||||
|
|
|
|||
35
src/main.rs
35
src/main.rs
|
|
@ -171,6 +171,7 @@ pub struct Flags {
|
|||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum Action {
|
||||
About,
|
||||
ColorSchemes(ColorSchemeKind),
|
||||
Copy,
|
||||
Find,
|
||||
|
|
@ -210,6 +211,7 @@ pub enum Action {
|
|||
impl Action {
|
||||
pub fn message(self, entity_opt: Option<segmented_button::Entity>) -> Message {
|
||||
match self {
|
||||
Action::About => Message::ToggleContextPage(ContextPage::About),
|
||||
Action::ColorSchemes(color_scheme_kind) => {
|
||||
Message::ToggleContextPage(ContextPage::ColorSchemes(color_scheme_kind))
|
||||
}
|
||||
|
|
@ -327,6 +329,7 @@ pub enum Message {
|
|||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum ContextPage {
|
||||
About,
|
||||
ColorSchemes(ColorSchemeKind),
|
||||
Profiles,
|
||||
Settings,
|
||||
|
|
@ -335,6 +338,7 @@ pub enum ContextPage {
|
|||
impl ContextPage {
|
||||
fn title(&self) -> String {
|
||||
match self {
|
||||
Self::About => fl!("about"),
|
||||
Self::ColorSchemes(_color_scheme_kind) => fl!("color-schemes"),
|
||||
Self::Profiles => fl!("profiles"),
|
||||
Self::Settings => fl!("settings"),
|
||||
|
|
@ -536,9 +540,9 @@ impl App {
|
|||
let (header_title, window_title) = match tab_model.text(tab_model.active()) {
|
||||
Some(tab_title) => (
|
||||
tab_title.to_string(),
|
||||
format!("{tab_title} — COSMIC Terminal"),
|
||||
format!("{tab_title} — {}", fl!("cosmic-terminal")),
|
||||
),
|
||||
None => (String::new(), "COSMIC Terminal".to_string()),
|
||||
None => (String::new(), fl!("cosmic-terminal")),
|
||||
};
|
||||
self.set_header_title(header_title);
|
||||
Command::batch([
|
||||
|
|
@ -548,7 +552,7 @@ impl App {
|
|||
} else {
|
||||
log::error!("Failed to get the specific pane");
|
||||
Command::batch([
|
||||
self.set_window_title("COSMIC Terminal".to_string(), window::Id::MAIN),
|
||||
self.set_window_title(fl!("cosmic-terminal"), window::Id::MAIN),
|
||||
self.update_focus(),
|
||||
])
|
||||
}
|
||||
|
|
@ -631,6 +635,30 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
fn about(&self) -> Element<Message> {
|
||||
let cosmic_theme::Spacing { space_xxs, .. } = self.core().system_theme().cosmic().spacing;
|
||||
widget::column::with_children(vec![
|
||||
widget::svg(widget::svg::Handle::from_memory(
|
||||
&include_bytes!(
|
||||
"../res/icons/hicolor/256x256/apps/com.system76.CosmicTerm.svg"
|
||||
)[..],
|
||||
))
|
||||
.into(),
|
||||
widget::text::heading(fl!("cosmic-terminal")).into(),
|
||||
widget::button::link("https://github.com/pop-os/cosmic-term")
|
||||
.padding(0)
|
||||
.into(),
|
||||
widget::text(fl!(
|
||||
"git-description",
|
||||
hash = env!("VERGEN_GIT_SHA"),
|
||||
date = env!("VERGEN_GIT_COMMIT_DATE")
|
||||
))
|
||||
.into(),
|
||||
])
|
||||
.spacing(space_xxs)
|
||||
.into()
|
||||
}
|
||||
|
||||
fn color_schemes(&self, color_scheme_kind: ColorSchemeKind) -> Element<Message> {
|
||||
let cosmic_theme::Spacing { space_xxxs, .. } = self.core().system_theme().cosmic().spacing;
|
||||
|
||||
|
|
@ -2274,6 +2302,7 @@ impl Application for App {
|
|||
}
|
||||
|
||||
Some(match self.context_page {
|
||||
ContextPage::About => self.about(),
|
||||
ContextPage::ColorSchemes(color_scheme_kind) => self.color_schemes(color_scheme_kind),
|
||||
ContextPage::Profiles => self.profiles(),
|
||||
ContextPage::Settings => self.settings(),
|
||||
|
|
|
|||
|
|
@ -226,6 +226,8 @@ pub fn menu_bar<'a>(config: &Config, key_binds: &HashMap<KeyBind, Action>) -> El
|
|||
Action::ColorSchemes(config.color_scheme_kind()),
|
||||
),
|
||||
menu_item(fl!("menu-settings"), Action::Settings),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_item(fl!("menu-about"), Action::About),
|
||||
],
|
||||
),
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue