diff options
| author | lukeflo | 2025-06-29 20:31:41 +0200 |
|---|---|---|
| committer | lukeflo | 2025-06-29 20:31:41 +0200 |
| commit | ae1667410b0a812fff8d464251548f23f88ae024 (patch) | |
| tree | 55569dfcd3c1b1a94537fcf30b1cea98c428f9f2 /src | |
| parent | 40629e0c2dc62bfb1786cb1c18bc68ed4c23e9ac (diff) | |
| download | bibiman-ae1667410b0a812fff8d464251548f23f88ae024.tar.gz bibiman-ae1667410b0a812fff8d464251548f23f88ae024.zip | |
some more tests for notes, need to elaborate function for opening notes
Diffstat (limited to 'src')
| -rw-r--r-- | src/app.rs | 22 | ||||
| -rw-r--r-- | src/bibiman.rs | 5 |
2 files changed, 15 insertions, 12 deletions
@@ -410,15 +410,6 @@ impl App { pub fn open_connected_file(cfg: &BibiConfig, file: &OsStr) -> Result<()> { // Build command to execute pdf-reader. 'xdg-open' is Linux standard let cmd = &cfg.general.pdf_opener; - // If necessary, replace ~ with /home dir - // let file = if cfg.general.file_prefix.is_some() { - // cfg.general.file_prefix.clone().unwrap().join(file) - // } else { - // PathBuf::from(file) - // }; - // let file = PathBuf::from(file); - - // let file = expand_home(&file).into_os_string(); // Pass filepath as argument, pipe stdout and stderr to /dev/null // to keep the TUI clean (where is it piped on Windows???) @@ -432,6 +423,19 @@ pub fn open_connected_file(cfg: &BibiConfig, file: &OsStr) -> Result<()> { Ok(()) } +pub fn open_connected_note(cfg: &BibiConfig, file: &OsStr) -> Result<()> { + // let cmd = cfg.general.editor.as_ref().unwrap(); + + let _ = Command::new("xdg-open") + .arg(file) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .spawn() + .wrap_err("Opening file not possible"); + + Ok(()) +} + pub fn open_connected_link(cfg: &BibiConfig, link: &str) -> Result<()> { // Build command to execute pdf-reader. 'xdg-open' is Linux standard let cmd = &cfg.general.url_opener; diff --git a/src/bibiman.rs b/src/bibiman.rs index 96a733c..1f19b24 100644 --- a/src/bibiman.rs +++ b/src/bibiman.rs @@ -692,12 +692,11 @@ impl Bibiman { None, )?; } - } - if self.popup_area.popup_list[popup_idx].0.contains("Note") { + } else if self.popup_area.popup_list[popup_idx].0.contains("Note") { let file = expand_home(&PathBuf::from(popup_entry.clone())); // let object: OsString = popup_entry.into(); if file.is_file() { - app::open_connected_file(cfg, &file.into_os_string())?; + app::open_connected_note(cfg, &file.into_os_string())?; self.close_popup(); } else { self.open_popup( |
