mirror of
https://github.com/sxyazi/yazi.git
synced 2024-10-03 21:58:14 +03:00
feat: support right-click to open files (#1232)
This commit is contained in:
parent
9961251248
commit
1a1da216ca
@ -45,7 +45,7 @@ impl CommandPub {
|
||||
pub(super) fn receiver(&self) -> Result<u64> {
|
||||
if let Some(receiver) = self.receiver {
|
||||
Ok(receiver)
|
||||
} else if let Ok(s) = std::env::var("YAZI_ID") {
|
||||
} else if let Some(s) = std::env::var("YAZI_PID").ok().filter(|s| !s.is_empty()) {
|
||||
Ok(s.parse()?)
|
||||
} else {
|
||||
bail!("No receiver ID provided, also no YAZI_ID environment variable found.")
|
||||
|
@ -42,6 +42,9 @@ pub fn init() {
|
||||
USERS_CACHE.with(Default::default);
|
||||
|
||||
// Env
|
||||
if let Some(s) = std::env::var("YAZI_ID").ok().filter(|s| !s.is_empty()) {
|
||||
std::env::set_var("YAZI_PID", s);
|
||||
}
|
||||
std::env::set_var("YAZI_ID", ID.to_string());
|
||||
std::env::set_var(
|
||||
"YAZI_LEVEL",
|
||||
|
@ -44,13 +44,18 @@ function Current:render(area)
|
||||
end
|
||||
|
||||
function Current:click(event, up)
|
||||
if up or not event.is_left then
|
||||
if up or event.is_middle then
|
||||
return
|
||||
end
|
||||
|
||||
local f = Folder:by_kind(Folder.CURRENT)
|
||||
if event.y <= #f.window and f.hovered then
|
||||
ya.manager_emit("arrow", { event.y + f.offset - f.hovered.idx })
|
||||
if event.y > #f.window or not f.hovered then
|
||||
return
|
||||
end
|
||||
|
||||
ya.manager_emit("arrow", { event.y + f.offset - f.hovered.idx })
|
||||
if event.is_right then
|
||||
ya.manager_emit("open", { hovered = true })
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user