change opener to rifle

This commit is contained in:
rabite 2019-02-09 19:34:21 +01:00
parent 528f725145
commit e07f9af433
3 changed files with 17 additions and 6 deletions

View File

@ -72,17 +72,17 @@ impl FileBrowser {
Err(ref err) if err.description() == "placeholder".to_string() =>
self.show_status("No! Can't open this!"),
_ => {
let status = std::process::Command::new("xdg-open")
.args(dbg!(file.path.file_name()))
let status = std::process::Command::new("rifle")
.args(file.path.file_name())
.status();
match status {
Ok(status) =>
self.show_status(&format!("\"{}\" exited with {}",
"xdg-open", status)),
"rifle", status)),
Err(err) =>
self.show_status(&format!("Can't run this \"{}\": {}",
"xdg-open", err))
"rifle", err))
}
}

View File

@ -3,6 +3,7 @@ use termion::event::{Event, Key};
use unicode_width::UnicodeWidthStr;
use std::path::{Path, PathBuf};
use std::io::Write;
use crate::coordinates::{Coordinates, Position, Size};
use crate::files::{File, Files};
@ -320,6 +321,11 @@ where
.arg("-c")
.arg(&cmd)
.status();
write!(std::io::stdout(), "{}{}",
termion::style::Reset,
termion::clear::All).unwrap();
match status {
Ok(status) => self.show_status(&format!("\"{}\" exited with {}",
cmd, status)),

View File

@ -74,6 +74,7 @@ where
//Self::clear_status();
let event = event.unwrap();
self.widget.on_event(event);
self.screen.cursor_hide();
self.draw();
}
}
@ -136,8 +137,8 @@ pub fn show_status(status: &str) {
pub fn minibuffer(query: &str) -> Option<String> {
show_status(&(query.to_string() + ": "));
write!(stdout(), "{}{}",
termion::cursor::Show,
termion::cursor::Save).unwrap();
termion::cursor::Show,
termion::cursor::Save).unwrap();
stdout().flush().unwrap();
let mut buffer = "".to_string();
@ -150,8 +151,12 @@ pub fn minibuffer(query: &str) -> Option<String> {
Key::Esc | Key::Ctrl('c') => break,
Key::Char('\n') => {
if buffer == "" {
write!(stdout(), "{}", termion::cursor::Hide).unwrap();
stdout().flush().unwrap();
return None;
} else {
write!(stdout(), "{}", termion::cursor::Hide).unwrap();
stdout().flush().unwrap();
return Some(buffer);
}
}