Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ HatchZip shows whether the files will fit before it changes anything. The archiv

To take only some files or folders out, select them in the app's contents list (Ctrl+click or Cmd+click adds a row, Shift+click a range, Space the row under the cursor), then choose **Extract selected…** and the destination folder. Only those are extracted, and the archive is always kept.

On Windows and macOS, rows can also be dragged from the contents list into a folder in Explorer or the Finder. Dragging a selected row takes the whole selection; any other row goes alone. The archive is kept, as with **Extract selected…**. On Windows the entries are extracted when they are dropped, into a temporary folder that Explorer copies from and that is removed when HatchZip closes; up to 1 GB can be dragged at once. On macOS the Finder has each entry written straight into the folder it was dropped in. Linux has no drag out yet.

To keep the archive when there is room for both, choose **Extract here (keep archive)** in the right-click menu. To always keep archives, as other extractors do, clear **Remove the archive during extraction** in the app's [settings](#settings); every right-click entry then keeps the archive too. That is a normal extraction: the archive is not changed, and space is required for all extracted files.

### Settings
Expand Down
53 changes: 49 additions & 4 deletions crates/gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,57 @@ slint = { version = "~1.18.1", default-features = false, features = [
"unstable-winit-030",
] }

# Receives the files Finder opens with HatchZip; already in the tree through
# winit, at the same versions.
# Receives the files Finder opens with HatchZip, and drags entries out of the
# contents tree as file promises; already in the tree through winit, at the
# same versions.
[target."cfg(target_os = \"macos\")".dependencies]
block2 = "0.6.2"
objc2 = "0.6.4"
objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std", "NSApplication", "NSResponder"] }
objc2-foundation = { version = "0.3.2", default-features = false, features = ["std", "NSArray", "NSEnumerator", "NSURL"] }
objc2-app-kit = { version = "0.3.2", default-features = false, features = [
"std",
"block2",
"NSApplication",
"NSDragging",
"NSDraggingItem",
"NSDraggingSession",
"NSEvent",
"NSFilePromiseProvider",
"NSImage",
"NSPasteboard",
"NSResponder",
"NSView",
"NSWorkspace",
] }
objc2-foundation = { version = "0.3.2", default-features = false, features = [
"std",
"NSArray",
"NSDictionary",
"NSEnumerator",
"NSError",
"NSGeometry",
"NSObject",
"NSOperation",
"NSString",
"NSURL",
] }

# Drags entries out of the contents tree into Explorer through OLE; already
# in the tree through Slint's accessibility and font crates, at this version.
[target."cfg(windows)".dependencies]
windows = { version = "0.62.2", features = [
"Win32_Foundation",
"Win32_Graphics_Gdi",
"Win32_System_Com",
"Win32_System_Com_StructuredStorage",
"Win32_System_Memory",
"Win32_System_Ole",
"Win32_System_SystemServices",
"Win32_UI_Shell",
"Win32_UI_Shell_Common",
"Win32_UI_WindowsAndMessaging",
] }
# The `implement` macro for the drop source names this crate directly.
windows-core = "0.62.2"

[features]
# RAR archives, through UnRAR's C++ source and its own license; see
Expand Down
1 change: 1 addition & 0 deletions crates/gui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The task forms are what file manager menus call, and installers run the two shel
| Existing files | When files the archive would write already exist in the destination, the main window and the task window ask once, with the number of files, whether to replace them, before anything is touched. "Replace" extracts as `hatchzip extract --replace` does; "Cancel" stops with nothing modified. Settings, "When a file already exists" can answer for every file instead: Replace as `--replace`, Skip as `--skip-existing`. A resumed run follows its journal and does not ask again. |
| Updates | Help > "Check for updates" opens the latest release page on GitHub in the browser. The app makes no network connections itself. |
| Giving up | A paused or partially extracted archive offers "Restore archive", which runs `hatchzip_core::restore` on a worker thread. Not for an extraction that keeps its archive, which was never changed. |
| Dragging out | Rows of the contents tree dragged into Explorer or the Finder are extracted there, with the archive kept, through the engine as for "Extract selected…" (`src/drag.rs`). A drag starts once a press moves 5 px; a selected row takes the selection, another row goes alone, and the dragged rows are dimmed until the drop. Only for an archive nothing was extracted from, while nothing runs; a run that changes the archive waits for a drop still being written. Windows (`platform/windows.rs`): OLE `DoDragDrop` with a CF_HDROP of paths under `%TEMP%\hatchzip-drag-<pid>`, extracted when the button is released over a folder that accepts the files, before Explorer copies them; the window waits for that, so a drag is limited to 1 GB, and the folder is removed when the app closes (or a day later, after a crash). macOS (`platform/macos.rs`): one `NSFilePromiseProvider` per row; the Finder asks for each once it knows the folder, and it is extracted next to it, on a thread of its own, and moved into place. Linux: winit has no drag source, so the gesture does nothing. |
| Keeping the archive | "Remove the archive during extraction", on by default. Cleared, the space plan is for every file, in bold next to what removing the archive would need, and the panel says when only removing it fits. A half-extracted archive continues the way it started. |
| Settings | A window of its own (`ui/settings-window.slint`, wired in `main_window.rs`), opened from File > Settings… or the gear, one instance. Sections: General (language, appearance, after extracting, closing the progress window), Extraction (removing the archive, verifying first, reserved space, default destination, existing files), Integration (the right-click menu, where `platform::SHELL_MENU`), Advanced (the file's path, Reset). Every change applies and is saved at once, and the main window's reserve, verify and remove controls follow it both ways. Saved to `~/.config/hatchzip/settings.json`, `%APPDATA%\HatchZip\settings.json` or `~/Library/Application Support/HatchZip/settings.json`. A missing or broken file means the defaults; a value this version can't read means the default for that one setting. The right-click menu switch is hidden on macOS, where hatchzip-shell can't add Finder entries yet. |
| Identity | App id and X11 class `io.github.xevrion.hatchzip`, matching the desktop file. On Windows `build.rs` embeds `assets/icon/hatchzip.ico` and the version into the exe. |
Expand Down
4 changes: 4 additions & 0 deletions crates/gui/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ impl CustomApplicationHandler for Handler {
// winit 0.30 reports dropped files on Windows, macOS and X11 only;
// on Wayland nothing arrives here and the Open button is the way in.
match event {
// Entries dragged out of the tree and back onto the window, from
// the folder they were extracted to; not an archive to open.
WindowEvent::DroppedFile(path) | WindowEvent::HoveredFile(path)
if crate::drag::is_ours(path) => {}
WindowEvent::DroppedFile(path) => {
if let Some(f) = &*self.0.on_hover.borrow() {
f(false);
Expand Down
Loading
Loading