Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: build
on:
push:
branches: [main]
paths-ignore: ["website/**", ".github/workflows/pages.yml"]
paths-ignore: ["website/**"]
pull_request:
paths-ignore: ["website/**", ".github/workflows/pages.yml"]
paths-ignore: ["website/**"]

permissions:
contents: read
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/pages.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
> **Status: pre-release (0.2).** ZipXP is under active development and the build is unsigned. Try it on a folder of copies first. See [Safety](docs/safety.md).

<p align="center">
<img src="assets/screenshots/overview.png" alt="ZipXP overview showing 74.1 MB saved, 54% less space used" width="760">
<img src="assets/screenshots/overview.png" alt="ZipXP overview showing 48.2 MB saved by ZipXP" width="760">
</p>
<p align="center"><sub>ZipXP after compressing a sample work folder (logs, CSV, JSON and source files; photos are skipped). The sample data is generated text, so your savings will differ.</sub></p>
<p align="center"><sub>ZipXP after compressing a generated test folder (repetitive text, logs, CSV and JSON, plus random data and a ZIP that are left alone). The data is synthetic and very compressible, so your savings will differ.</sub></p>

## Why ZipXP

Expand Down Expand Up @@ -52,12 +52,12 @@ dotnet run --project src/ZipXP.App/ZipXP.App.csproj

If WebView2 is unavailable, pass `-- --native-ui` to the run command for the original WPF interface.

Then choose **Managed folders → Add folder…**, pick a test folder that holds copies of some documents, and read the estimate. To build a package you can install, see [Install and uninstall](docs/install.md).
On first launch ZipXP suggests folders that usually compress well, such as a code folder or Documents. Choose one (or **Choose a folder**) and read the estimate before deciding anything. To build a package you can install, see [Install and uninstall](docs/install.md).

Storage insights shows which folders take the room and what was saved in each:
Storage insights lists what takes the room in each folder, with every file's original size, size now and space saved:

<p align="center">
<img src="assets/screenshots/storage-insights.png" alt="ZipXP storage insights by folder" width="760">
<img src="assets/screenshots/storage-insights.png" alt="ZipXP storage insights listing per-file original size, size used now and space saved" width="760">
</p>

Compression savings depend entirely on what is in the folder. One known accounting issue (see [validation](docs/validation.md)) can overstate how much space is freed after restoring some files. Text, source code, documents and logs shrink well; photos, video and archives are already compressed and barely change. ZipXP measures the real result per file and skips files that don't benefit.
Expand Down
Binary file modified assets/screenshots/managed-folders.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/screenshots/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/screenshots/storage-insights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

## Getting started

1. Select **Add folder** and choose a folder on a local NTFS drive, such as `C:\zipxp-test`. ZipXP selects it in **Managed folders** and scans it without changing files.
2. Check the folder’s estimated savings. **Compress once** previews a one-time job. **Turn on auto-compression** asks you to confirm before ZipXP starts handling eligible existing, new, copied and changed files in the background.
1. On first launch, pick one of the suggested folders (a code folder or Documents usually saves the most) or select **Choose a folder** for any folder on a local NTFS drive. Avoid photos, videos, music, system folders and cloud-synced folders such as OneDrive; they are already compressed or are skipped. ZipXP then asks how to handle it: **Scan, then let me choose** (the default, which only reads the folder) or **Scan and keep compressed automatically**. Either way, ZipXP selects the folder in **Managed folders** and scans it first.
2. Check the folder’s estimated savings. While a job runs, the folder shows a progress card with files done, space saved so far, the current file and **Pause folder** (and **Stop** for one-time jobs). If it is waiting, it says why, such as on battery or outside your schedule. **Compress once** previews a one-time job, which is the recommended first step. After it finishes, ZipXP offers **Keep compressing automatically**. **Turn on auto-compression** asks you to confirm before ZipXP starts handling eligible existing, new, copied and changed files in the background. Compressed files use a little CPU when opened, which is usually unnoticeable on an SSD but can be slower on a hard disk.
If a scan finds no savings, ZipXP says why: **Already compact** (the files are already compressed, which is a good result), **Nothing compressible** (mostly media or archives), or **Mostly small or excluded files**. **Why some files were skipped** lists the counts.
3. In **Overview**, **Estimated savings** comes from the latest scans. **Space saved by ZipXP** counts the net disk space change ZipXP measured from its own compression and restores. **Folder size on disk** shows how much space the measured files currently use.
4. Use **Folder settings** to choose subfolders, exclusions and when ZipXP can work. Use **Browse files** to inspect a folder and **Activity** to track progress or retry failed work.
5. Close the window to keep ZipXP running in the tray. Enable **Start when I sign in** if you want ZipXP to start with Windows. **Pause all folders** or **More actions → Pause folder** pauses work after the current file. **Quit ZipXP** stops background work and keeps the queue for next time.
5. Close the window to keep ZipXP running in the tray. Its tooltip shows the space saved so far, and ZipXP shows a notification when background compression finishes and a short summary once a week. Enable **Start when I sign in** if you want ZipXP to start with Windows. **Pause all folders** or **More actions → Pause folder** pauses work after the current file. **Quit ZipXP** stops background work and keeps the queue for next time.

### Decompression and stopping management

Expand Down
12 changes: 4 additions & 8 deletions scripts/test-existing-folder.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,9 @@ try {
if ((Find-Id 'PauseButton').Current.Name -ne 'Resume all') { Invoke-Id 'PauseButton' }
Wait-For { (Find-Id 'PauseButton').Current.Name -eq 'Resume all' } 'Paused before enabling the automatic policy'
Invoke-Name 'Managed folders'
Invoke-Name 'Folder settings*'
Wait-For { Find-Dialog 'Folder settings' } 'Policy editor opened'
$editor = Find-Dialog 'Folder settings'
$enable = Find-Id 'EnableBox' $editor
$toggle = $enable.GetCurrentPattern([Windows.Automation.TogglePattern]::Pattern)
if ($toggle.Current.ToggleState -ne [Windows.Automation.ToggleState]::On) { $toggle.Toggle() }
Invoke-Name 'Save' $editor
Invoke-Id 'FolderAutomationButton'
Wait-For { Find-Dialog 'Turn on auto-compression' } 'Auto-compression confirmation opened from Managed folders'
Confirm-Yes (Find-Dialog 'Turn on auto-compression')
Wait-For { $s = State; $s.Roots[0].Policy.Enabled -and @($s.Jobs | Where-Object { $_.State -eq 'Queued' }).Count -gt 0 } 'Default automatic policy saved and candidates queued'
Helper -Arguments @('read', $data, (Join-Path $Evidence 'queued-state.json'))

Expand Down Expand Up @@ -211,7 +207,7 @@ try {
}

Invoke-Name 'Managed folders'
Invoke-Name 'Restore original size*'
Invoke-Name 'Restore files*'
Wait-For { Find-Dialog 'Restore original size' } 'Recursive decompression preview displayed'
$preview = Find-Dialog 'Restore original size'
$previewText = $preview.FindAll([Windows.Automation.TreeScope]::Descendants, [Windows.Automation.Condition]::TrueCondition) | ForEach-Object { $_.Current.Name }
Expand Down
11 changes: 0 additions & 11 deletions src/ZipXP.App/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@
<Setter Property="FontSize" Value="13" /><Setter Property="VerticalAlignment" Value="Center" />
</Style>
<BooleanToVisibilityConverter x:Key="BoolToVis" />
<Style x:Key="StepNumber" TargetType="Border">
<Setter Property="Width" Value="26" /><Setter Property="Height" Value="26" /><Setter Property="CornerRadius" Value="13" /><Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Margin" Value="0,0,12,0" /><Setter Property="BorderThickness" Value="1.5" /><Setter Property="BorderBrush" Value="{DynamicResource AccentFillColorDefaultBrush}" />
</Style>
<Style x:Key="StepDigit" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" /><Setter Property="VerticalAlignment" Value="Center" /><Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorPrimaryBrush}" />
</Style>
<Style x:Key="StepTitle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold" /><Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
</Style>
<Style x:Key="StatValueSmall" TargetType="TextBlock">
<Setter Property="FontSize" Value="20" /><Setter Property="FontWeight" Value="SemiBold" /><Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
Expand Down
70 changes: 70 additions & 0 deletions src/ZipXP.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Text;
using System.Windows;
using System.Windows.Threading;
using ZipXP.Core;
using ZipXP.Core.Persistence;
using ZipXP.Core.Services;
using Forms = System.Windows.Forms;
Expand All @@ -18,6 +19,11 @@ public partial class App : Application
private RegisteredWaitHandle? activationWait;
private Forms.NotifyIcon? tray;
private Store? store;
private DispatcherTimer? savingsTimer;
private bool hadPendingWork;
private volatile bool checkingSavings;
private long notifiedSavings;
private DateTime lastCompletionBalloon = DateTime.MinValue;
public Engine Engine { get; private set; } = null!;
public bool Exiting { get; private set; }
public static App Instance => (App)Current;
Expand All @@ -42,6 +48,7 @@ protected override void OnStartup(StartupEventArgs e)
try { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal; } catch (System.ComponentModel.Win32Exception) { }
MainWindow = e.Args.Contains("--native-ui") ? new MainWindow() : new ReactWindow();
CreateTray();
WatchSavings();
Engine.Start();
if (!e.Args.Contains("--tray")) ShowMain();
// Dev launcher (scripts/dev.sh) creates this file on Ctrl+C to ask for a clean shutdown.
Expand Down Expand Up @@ -93,6 +100,68 @@ private void CreateTray()
tray.DoubleClick += (_, _) => Dispatcher.BeginInvoke(ShowMain);
}

/// <summary>Keeps the tray tooltip showing the running total and announces finished work and a weekly summary.</summary>
private void WatchSavings()
{
notifiedSavings = store!.MeasuredSince(DateTime.MinValue).Delta;
UpdateTrayTip(notifiedSavings);
savingsTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };
savingsTimer.Tick += (_, _) =>
{
if (Exiting || checkingSavings) return;
checkingSavings = true;
// Database reads can wait behind the engine, so keep them off the UI thread. Notifications are a
// nicety: a transient database error must never disturb the app.
_ = Task.Run(() => { try { return CheckSavings(); } catch (Exception) { return null; } })
.ContinueWith(t => { checkingSavings = false; if (t.Result is { } apply && !Exiting) apply(); }, TaskScheduler.FromCurrentSynchronizationContext());
};
savingsTimer.Start();
}

private void UpdateTrayTip(long total)
{
if (tray != null) tray.Text = total > 0 ? $"ZipXP · {Display.Bytes(total)} saved" : "ZipXP";
}

/// <summary>Runs on a worker thread; returns the tray updates to apply on the UI thread.</summary>
private Action? CheckSavings()
{
var pending = store!.HasActiveJobs();
var total = store.MeasuredSince(DateTime.MinValue).Delta;
var watching = false;
Dispatcher.Invoke(() => watching = MainWindow is { IsVisible: true, IsActive: true });
string? balloonTitle = null, balloonText = null;
if (pending && !hadPendingWork) notifiedSavings = total; // measure each run from its own start
if (hadPendingWork && !pending)
{
var gained = total - notifiedSavings;
// Background auto-compression finishes many small runs, so it needs a much bigger gain to be worth a balloon.
var bar = store.Roots().Any(r => r.Policy.Enabled) ? 100L * 1024 * 1024 : 1024 * 1024;
if (gained >= bar && !watching && DateTime.UtcNow - lastCompletionBalloon > TimeSpan.FromMinutes(30))
{
balloonTitle = "ZipXP finished compressing"; balloonText = $"Saved {Display.Bytes(gained)}. Your files open as usual.";
lastCompletionBalloon = DateTime.UtcNow;
}
notifiedSavings = total;
}
hadPendingWork = pending;

// At most one summary a week, and only when ZipXP actually saved something.
var last = DateTime.TryParse(store.Setting("lastDigestUtc"), null, System.Globalization.DateTimeStyles.RoundtripKind, out var parsed) ? parsed : (DateTime?)null;
if (last == null) store.Setting("lastDigestUtc", DateTime.UtcNow.ToString("O"));
else if (DateTime.UtcNow - last.Value >= TimeSpan.FromDays(7))
{
var week = store.MeasuredSince(DateTime.UtcNow.AddDays(-7)).Delta;
store.Setting("lastDigestUtc", DateTime.UtcNow.ToString("O"));
if (week > 0 && balloonTitle == null) { balloonTitle = "Your ZipXP weekly summary"; balloonText = $"ZipXP saved {Display.Bytes(week)} this week."; }
}
return () =>
{
UpdateTrayTip(total);
if (balloonTitle != null) tray?.ShowBalloonTip(7000, balloonTitle, balloonText ?? "", Forms.ToolTipIcon.Info);
};
}

public void ShowMain()
{
if (MainWindow == null || Exiting) return;
Expand All @@ -112,6 +181,7 @@ public async Task ExitAsync()
Exiting = true;
if (MainWindow is MainWindow window) window.ShowClosingStatus();
if (MainWindow is ReactWindow reactWindow) reactWindow.ShowClosingStatus();
savingsTimer?.Stop();
if (Engine != null) await Engine.DisposeAsync();
tray?.Dispose(); tray = null;
Shutdown();
Expand Down
Loading
Loading