Skip to content

Commit 4da7eae

Browse files
authored
Merge pull request #10 from basdebue/schemeless
Assume gemini:// for schemeless URLs in the omnibar
2 parents 501b9fc + 4dbac09 commit 4da7eae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/window.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,13 @@ impl Window {
360360
}
361361
fn open_omni(&self, v: &str) {
362362
let url = Url::parse(v)
363-
.or_else(|_| Url::parse(&format!("gemini://geminispace.info/search?{}", v)));
363+
.or_else(|_| {
364+
if v.contains(".") && v.split(".").all(|s| s.chars().all(char::is_alphanumeric)) {
365+
Url::parse(&format!("gemini://{}", v))
366+
} else {
367+
Url::parse(&format!("gemini://geminispace.info/search?{}", v))
368+
}
369+
});
364370
match url {
365371
Ok(url) => self.current_tab().spawn_open_url(url),
366372
Err(e) => error!("Failed to open from omni bar"),

0 commit comments

Comments
 (0)