Skip to content

Commit

Permalink
style(term): show help key for brose entry command
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed Aug 31, 2024
1 parent 96e4762 commit ba7bb2f
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 24 deletions.
14 changes: 12 additions & 2 deletions crates/synd_term/src/interact/process.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{
io::{self},
io::{self, ErrorKind},
path::PathBuf,
process::{Command, Stdio},
};
Expand Down Expand Up @@ -53,14 +53,24 @@ impl TextBrowserInteractor {
}

impl OpenTextBrowser for TextBrowserInteractor {
#[tracing::instrument(skip(self))]
fn open_text_browser(&self, url: Url) -> Result<(), OpenBrowserError> {
let status = Command::new(self.command.as_os_str())
.args(self.args.iter())
.arg(url.as_str())
.stdin(Stdio::inherit())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.output()?
.output()
.map_err(|err| {
if err.kind() == ErrorKind::NotFound {
OpenBrowserError::CommandNotFound {
command: self.command.clone(),
}
} else {
err.into()
}
})?
.status;

if status.success() {
Expand Down
6 changes: 5 additions & 1 deletion crates/synd_term/src/ui/components/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ impl StatusLine {
.chain(suf_keys),
Some(Tab::Entries) => pre_keys
.iter()
.chain(&[("h/l", icon!(requirement)), ("Ent", icon!(open))])
.chain(&[
("h/l", icon!(requirement)),
("Ent", icon!(open)),
("Sp", icon!(browse)),
])
.chain(suf_keys),
Some(Tab::GitHub) => pre_keys
.iter()
Expand Down
1 change: 1 addition & 0 deletions crates/synd_term/src/ui/icon.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[rustfmt::skip]
macro_rules! icon {
(browse) => { "󰏋" };
(feeds) => { "󰑫" };
(feedsoff) => { "󰑫" };
(entries) => { "󱉯" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Buffer {
" ## Booking.com’s o11y platform ",
" ",
" Santanu Sahoo shared [Events: The 4th pillar of Booking.com’s Observability platform][1] where he describes ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 r:󰑓 q: ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 Sp:󰏋 r:󰑓 q: ",
],
styles: [
x: 0, y: 0, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
Expand Down Expand Up @@ -99,7 +99,7 @@ Buffer {
x: 13, y: 23, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 2, y: 25, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: BOLD | UNDERLINED,
x: 11, y: 25, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 30, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 90, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 27, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 93, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Buffer {
" ## Booking.com’s o11y platform ",
" ",
" Santanu Sahoo shared [Events: The 4th pillar of Booking.com’s Observability platform][1] where he describes ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 r:󰑓 q: ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 Sp:󰏋 r:󰑓 q: ",
],
styles: [
x: 0, y: 0, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
Expand Down Expand Up @@ -93,7 +93,7 @@ Buffer {
x: 13, y: 23, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 2, y: 25, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: BOLD | UNDERLINED,
x: 11, y: 25, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 30, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 90, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 27, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 93, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Buffer {
" Hello and welcome to another issue of *This Week in Rust*! [Rust][1] is a programming language empowering everyone ",
" to build reliable and efficient software. This is a weekly summary of its progress and community. Want something ",
" mentioned? Tag us at [@ThisWeekInRust][2] on X(formerly Twitter) or [@ThisWeekinRust][3] on mastodon.social … ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 r:󰑓 q: ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 Sp:󰏋 r:󰑓 q: ",
],
styles: [
x: 0, y: 0, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
Expand Down Expand Up @@ -65,7 +65,7 @@ Buffer {
x: 13, y: 23, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 2, y: 25, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: BOLD | UNDERLINED,
x: 11, y: 25, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 30, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 90, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 27, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 93, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Buffer {
" Hello and welcome to another issue of *This Week in Rust*! [Rust][1] is a programming language empowering everyone ",
" to build reliable and efficient software. This is a weekly summary of its progress and community. Want something ",
" mentioned? Tag us at [@ThisWeekInRust][2] on X(formerly Twitter) or [@ThisWeekinRust][3] on mastodon.social … ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 r:󰑓 q: ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 Sp:󰏋 r:󰑓 q: ",
],
styles: [
x: 0, y: 0, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
Expand Down Expand Up @@ -69,7 +69,7 @@ Buffer {
x: 13, y: 23, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 2, y: 25, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: BOLD | UNDERLINED,
x: 11, y: 25, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 30, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 90, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 27, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 93, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Buffer {
" ",
" ",
" ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 r:󰑓 q: ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 Sp:󰏋 r:󰑓 q: ",
],
styles: [
x: 0, y: 0, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
Expand All @@ -51,7 +51,7 @@ Buffer {
x: 10, y: 2, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 0, y: 4, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: BOLD | UNDERLINED,
x: 0, y: 5, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 30, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 90, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 27, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 93, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Buffer {
" ",
" ",
" ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 r:󰑓 q: ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 Sp:󰏋 r:󰑓 q: ",
],
styles: [
x: 0, y: 0, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
Expand All @@ -51,7 +51,7 @@ Buffer {
x: 10, y: 2, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 0, y: 4, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: BOLD | UNDERLINED,
x: 0, y: 5, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 30, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 90, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 27, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 93, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Buffer {
" ",
" ",
" ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 r:󰑓 q: ",
" Tab:󰹳 j/k:󰹹 gg:󱞧 ge:󱞥 c: /: h/l: Ent:󰏌 Sp:󰏋 r:󰑓 q: ",
],
styles: [
x: 0, y: 0, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
Expand All @@ -51,7 +51,7 @@ Buffer {
x: 10, y: 2, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 0, y: 4, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: BOLD | UNDERLINED,
x: 0, y: 5, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 30, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 90, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 27, y: 29, fg: Rgb(111, 93, 99), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
x: 93, y: 29, fg: Rgb(254, 205, 178), bg: Rgb(43, 41, 45), underline: Reset, modifier: NONE,
]
}

0 comments on commit ba7bb2f

Please sign in to comment.