mirror of
https://github.com/tobi/disktree.git
synced 2026-11-28 16:00:45 +00:00
macOS: ⌘[ and ⌘] for back and forward, and a Go menu
What Finder and Safari use; alt-arrows from #12 still work. Only on the explore screen, where the history buttons are. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1220150762
commit
41331f363f
@@ -158,8 +158,8 @@ continuous motion, with the directory's contents growing into place. Scroll the
|
||||
other way to come back out. Enter goes into the selected directory at any
|
||||
depth, and Backspace or Escape goes up one level. `<` and `>`, beside the
|
||||
Size / Files / Age switch, go back and forward through the directories visited,
|
||||
as do `alt ←` `alt →` and the mouse's side buttons. `+` and `-` magnify without
|
||||
going in; `0` resets.
|
||||
as do `alt ←` `alt →` (also `⌘[` `⌘]` on macOS) and the mouse's side
|
||||
buttons. `+` and `-` magnify without going in; `0` resets.
|
||||
|
||||
### Removing
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ mod menu_actions {
|
||||
OpenFolder,
|
||||
/// Reveal the tile a key acts on in Finder.
|
||||
ShowInFinder,
|
||||
/// Back through the directories visited.
|
||||
GoBack,
|
||||
/// Forward again, after going back.
|
||||
GoForward,
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -62,8 +66,8 @@ pub fn install(cx: &mut App) {
|
||||
let _ = window.update(cx, |_, window, _| window.remove_window());
|
||||
}
|
||||
});
|
||||
// `Rescan`, `OpenFolder` and `ShowInFinder` are handled by the window,
|
||||
// which owns the scan and the selection; see `views::root`.
|
||||
// `Rescan`, `OpenFolder`, `ShowInFinder` and the history are handled by
|
||||
// the window, which owns the scan and the selection; see `views::root`.
|
||||
cx.bind_keys([
|
||||
KeyBinding::new("cmd-q", Quit, None),
|
||||
KeyBinding::new("cmd-h", Hide, None),
|
||||
@@ -74,6 +78,9 @@ pub fn install(cx: &mut App) {
|
||||
// ⌘R is taken by Rescan, as in a browser; Xcode uses ⌘⇧R-like
|
||||
// chords for its reveals, and `o` does the same without a modifier.
|
||||
KeyBinding::new("cmd-shift-r", ShowInFinder, None),
|
||||
// Finder's and Safari's back and forward; alt-arrows work too.
|
||||
KeyBinding::new("cmd-[", GoBack, None),
|
||||
KeyBinding::new("cmd-]", GoForward, None),
|
||||
]);
|
||||
cx.set_menus([
|
||||
Menu::new("disktree").items([
|
||||
@@ -93,5 +100,9 @@ pub fn install(cx: &mut App) {
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Close Window", CloseWindow),
|
||||
]),
|
||||
Menu::new("Go").items([
|
||||
MenuItem::action("Back", GoBack),
|
||||
MenuItem::action("Forward", GoForward),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,19 @@ pub fn root(
|
||||
this.reveal_target(cx);
|
||||
},
|
||||
))
|
||||
// Only where the history buttons are: the review screen has none.
|
||||
.on_action(cx.listener(|this, _: &crate::app_menu::GoBack, _, cx| {
|
||||
if this.screen == Screen::Explore {
|
||||
this.go_back(cx);
|
||||
}
|
||||
}))
|
||||
.on_action(cx.listener(
|
||||
|this, _: &crate::app_menu::GoForward, _, cx| {
|
||||
if this.screen == Screen::Explore {
|
||||
this.go_forward(cx);
|
||||
}
|
||||
},
|
||||
))
|
||||
.on_key_down(cx.listener(|this, event: &KeyDownEvent, window, cx| {
|
||||
if this.zoom_interface(event, window) {
|
||||
cx.notify();
|
||||
|
||||
Reference in New Issue
Block a user