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
2 changes: 1 addition & 1 deletion .github/workflows/cleanzip-liquid-glass-icon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
release_tag:
description: "Release tag to update"
required: true
default: "v2.6.32"
default: "v2.6.33"
upload_release:
description: "Upload pkg, zip, and checksums to the release"
required: true
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
·
<a href="https://lyc280705.github.io/CleanZip/">Product page</a>
·
<a href="https://github.com/lyc280705/CleanZip/releases/tag/v2.6.32">CleanZip 2.6.32</a>
<a href="https://github.com/lyc280705/CleanZip/releases/tag/v2.6.33">CleanZip 2.6.33</a>
·
<a href="#build-from-source">Build from source</a>
</p>
Expand Down Expand Up @@ -59,7 +59,7 @@ It is intentionally small: no always-on background app, no history database, no

## Download

Download `CleanZip-2.6.32.pkg` from the [latest release](https://github.com/lyc280705/CleanZip/releases/latest). For most users, the `.pkg` installer is the easiest option.
Download `CleanZip-2.6.33.pkg` from the [latest release](https://github.com/lyc280705/CleanZip/releases/latest). For most users, the `.pkg` installer is the easiest option.

The installer places:

Expand All @@ -70,9 +70,9 @@ CleanZip is ad-hoc signed for open source distribution, but it is not notarized

For the `.pkg` installer:

1. In Finder, Control-click `CleanZip-2.6.32.pkg` and choose **Open**.
1. In Finder, Control-click `CleanZip-2.6.33.pkg` and choose **Open**.
2. If the same warning still appears with only **Done** and **Move to Trash**, open **System Settings** -> **Privacy & Security**.
3. At the bottom of Privacy & Security, choose **Open Anyway** for `CleanZip-2.6.32.pkg`, then confirm.
3. At the bottom of Privacy & Security, choose **Open Anyway** for `CleanZip-2.6.33.pkg`, then confirm.

After installation, if macOS blocks `CleanZip.app` itself, Control-click `CleanZip.app` in `/Applications` and choose **Open**. If it is still blocked, use **System Settings** -> **Privacy & Security** -> **Open Anyway** for `CleanZip.app`.

Expand All @@ -81,11 +81,11 @@ After you approve the installer or app once, macOS opens it normally.
Advanced terminal alternative for the downloaded package:

```bash
xattr -dr com.apple.quarantine ~/Downloads/CleanZip-2.6.32.pkg
open ~/Downloads/CleanZip-2.6.32.pkg
xattr -dr com.apple.quarantine ~/Downloads/CleanZip-2.6.33.pkg
open ~/Downloads/CleanZip-2.6.33.pkg
```

Manual installation is also available from `CleanZip-2.6.32.zip`: move `CleanZip.app` to `/Applications` and `CleanZipService.service` to `/Library/Services`.
Manual installation is also available from `CleanZip-2.6.33.zip`: move `CleanZip.app` to `/Applications` and `CleanZipService.service` to `/Library/Services`.

## Compatibility

Expand Down Expand Up @@ -172,7 +172,7 @@ gh workflow run cleanzip-liquid-glass-icon.yml --repo lyc280705/CleanZip --ref m
To rebuild and update an existing GitHub release asset set:

```sh
gh workflow run cleanzip-liquid-glass-icon.yml --repo lyc280705/CleanZip --ref main -f release_tag=v2.6.32 -f upload_release=true
gh workflow run cleanzip-liquid-glass-icon.yml --repo lyc280705/CleanZip --ref main -f release_tag=v2.6.33 -f upload_release=true
```

Lightweight local fallback with Command Line Tools:
Expand Down
2 changes: 1 addition & 1 deletion work/CleanZipBuild/src/CleanZip-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<key>CFBundleShortVersionString</key>
<string>2.6</string>
<key>CFBundleVersion</key>
<string>32</string>
<string>33</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion work/CleanZipBuild/src/CleanZipService-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<key>CFBundleShortVersionString</key>
<string>2.6</string>
<key>CFBundleVersion</key>
<string>32</string>
<string>33</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>LSUIElement</key>
Expand Down
101 changes: 16 additions & 85 deletions work/CleanZipBuild/src/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -681,12 +681,16 @@ enum FinderTableBehavior {
table.allowsMultipleSelection = allowsMultipleSelection
table.rowHeight = 26
table.headerView = NSTableHeaderView()
table.columnAutoresizingStyle = .firstColumnOnlyAutoresizingStyle
table.columnAutoresizingStyle = .reverseSequentialColumnAutoresizingStyle
table.autosaveName = autosaveName
table.autosaveTableColumns = true
table.backgroundColor = .clear
}

static func resizingMask(isFlexibleColumn: Bool) -> NSTableColumn.ResizingOptions {
isFlexibleColumn ? [.userResizingMask, .autoresizingMask] : [.userResizingMask]
}

static func shouldReorderColumn(
in tableView: NSTableView,
columnIndex: Int,
Expand All @@ -703,55 +707,6 @@ enum FinderTableBehavior {
}
}

final class FinderTableScrollView: NSScrollView {
private var isRebalancingColumns = false
private var lastViewportWidth: CGFloat = 0
private var columnsWereFitted = true

override func layout() {
super.layout()
rebalanceColumnsToViewport()
}

func rebalanceColumnsToViewport(resizedColumn: NSTableColumn? = nil) {
guard !isRebalancingColumns,
let table = documentView as? NSTableView,
let firstColumn = table.tableColumns.first,
table.numberOfColumns > 0 else { return }

let viewportWidth = floor(contentView.bounds.width)
guard viewportWidth > 0 else { return }
let columnsWidth = ceil(table.rect(ofColumn: table.numberOfColumns - 1).maxX)
let isInitialLayout = lastViewportWidth <= 0
let viewportChanged = !isInitialLayout && abs(viewportWidth - lastViewportWidth) > 0.5
guard isInitialLayout || viewportChanged || resizedColumn != nil else { return }

let gap = viewportWidth - columnsWidth
let nonFirstColumnChanged = resizedColumn != nil && resizedColumn !== firstColumn
let shouldRebalance = isInitialLayout || gap > 0.5 || (columnsWereFitted && (viewportChanged || nonFirstColumnChanged))

if shouldRebalance && abs(gap) > 0.5 {
isRebalancingColumns = true
firstColumn.width = min(firstColumn.maxWidth, max(firstColumn.minWidth, firstColumn.width + gap))
isRebalancingColumns = false
}

let fittedWidth = ceil(table.rect(ofColumn: table.numberOfColumns - 1).maxX)
columnsWereFitted = abs(viewportWidth - fittedWidth) <= 1
lastViewportWidth = viewportWidth

let documentWidth = max(viewportWidth, fittedWidth)
if abs(table.frame.width - documentWidth) > 0.5 {
isRebalancingColumns = true
let autoresizingStyle = table.columnAutoresizingStyle
table.columnAutoresizingStyle = .noColumnAutoresizing
table.setFrameSize(NSSize(width: documentWidth, height: table.frame.height))
table.columnAutoresizingStyle = autoresizingStyle
isRebalancingColumns = false
}
}
}

struct SystemContentBackground: NSViewRepresentable {
func makeNSView(context: Context) -> NSVisualEffectView {
let view = NSVisualEffectView()
Expand Down Expand Up @@ -1099,17 +1054,6 @@ struct ArchiveEntriesTable: NSViewRepresentable {
return cell
}

func tableViewColumnDidResize(_ notification: Notification) {
guard let tableView = notification.object as? NSTableView else { return }
let resizedColumn = notification.userInfo?["NSTableColumn"] as? NSTableColumn
(tableView.enclosingScrollView as? FinderTableScrollView)?.rebalanceColumnsToViewport(resizedColumn: resizedColumn)
}

func tableViewColumnDidMove(_ notification: Notification) {
guard let tableView = notification.object as? NSTableView else { return }
(tableView.enclosingScrollView as? FinderTableScrollView)?.rebalanceColumnsToViewport()
}

func tableView(_ tableView: NSTableView, shouldReorderColumn columnIndex: Int, toColumn newColumnIndex: Int) -> Bool {
FinderTableBehavior.shouldReorderColumn(
in: tableView,
Expand All @@ -1131,10 +1075,10 @@ struct ArchiveEntriesTable: NSViewRepresentable {
FinderTableBehavior.configure(
table,
allowsMultipleSelection: false,
autosaveName: "local.codex.cleanzip.archiveEntriesTable.v7"
autosaveName: "local.codex.cleanzip.archiveEntriesTable.v13"
)
let columns: [(String, String, CGFloat, CGFloat, CGFloat)] = [
("name", L10n.tr("column.name"), 380, 180, .greatestFiniteMagnitude),
("name", L10n.tr("column.name"), 360, 180, .greatestFiniteMagnitude),
("size", L10n.tr("column.size"), 140, 96, 280),
("modified", L10n.tr("column.modified"), 240, 190, 2000)
]
Expand All @@ -1144,12 +1088,12 @@ struct ArchiveEntriesTable: NSViewRepresentable {
column.width = spec.2
column.minWidth = spec.3
column.maxWidth = spec.4
column.resizingMask = [.userResizingMask, .autoresizingMask]
column.resizingMask = FinderTableBehavior.resizingMask(isFlexibleColumn: spec.0 == "name")
table.addTableColumn(column)
}
table.delegate = context.coordinator
table.dataSource = context.coordinator
let scroll = FinderTableScrollView()
let scroll = NSScrollView()
scroll.hasVerticalScroller = true
scroll.hasHorizontalScroller = true
scroll.autohidesScrollers = true
Expand All @@ -1167,7 +1111,6 @@ struct ArchiveEntriesTable: NSViewRepresentable {
context.coordinator.filter = filter
table.reloadData()
}
(scrollView as? FinderTableScrollView)?.rebalanceColumnsToViewport()
}
}

Expand Down Expand Up @@ -1222,17 +1165,6 @@ struct SelectedItemsTable: NSViewRepresentable {
}
}

func tableViewColumnDidResize(_ notification: Notification) {
guard let tableView = notification.object as? NSTableView else { return }
let resizedColumn = notification.userInfo?["NSTableColumn"] as? NSTableColumn
(tableView.enclosingScrollView as? FinderTableScrollView)?.rebalanceColumnsToViewport(resizedColumn: resizedColumn)
}

func tableViewColumnDidMove(_ notification: Notification) {
guard let tableView = notification.object as? NSTableView else { return }
(tableView.enclosingScrollView as? FinderTableScrollView)?.rebalanceColumnsToViewport()
}

func tableView(_ tableView: NSTableView, shouldReorderColumn columnIndex: Int, toColumn newColumnIndex: Int) -> Bool {
FinderTableBehavior.shouldReorderColumn(
in: tableView,
Expand Down Expand Up @@ -1335,28 +1267,28 @@ struct SelectedItemsTable: NSViewRepresentable {
FinderTableBehavior.configure(
table,
allowsMultipleSelection: true,
autosaveName: "local.codex.cleanzip.selectedItemsTable.v7"
autosaveName: "local.codex.cleanzip.selectedItemsTable.v13"
)

let columns: [(String, String, CGFloat, CGFloat, CGFloat)] = [
("selectedName", L10n.tr("column.name"), 260, 180, .greatestFiniteMagnitude),
("selectedType", L10n.tr("column.type"), 90, 70, 160),
("selectedSize", L10n.tr("column.size"), 120, 90, 220),
("selectedLocation", L10n.tr("column.location"), 360, 220, 2000)
("selectedName", L10n.tr("column.name"), 230, 180, .greatestFiniteMagnitude),
("selectedType", L10n.tr("column.type"), 80, 70, 160),
("selectedSize", L10n.tr("column.size"), 100, 90, 220),
("selectedLocation", L10n.tr("column.location"), 330, 220, 2000)
]
for spec in columns {
let column = NSTableColumn(identifier: NSUserInterfaceItemIdentifier(spec.0))
column.title = spec.1
column.width = spec.2
column.minWidth = spec.3
column.maxWidth = spec.4
column.resizingMask = [.userResizingMask, .autoresizingMask]
column.resizingMask = FinderTableBehavior.resizingMask(isFlexibleColumn: spec.0 == "selectedName")
table.addTableColumn(column)
}
table.delegate = context.coordinator
table.dataSource = context.coordinator

let scroll = FinderTableScrollView()
let scroll = NSScrollView()
scroll.hasVerticalScroller = true
scroll.hasHorizontalScroller = true
scroll.autohidesScrollers = true
Expand All @@ -1381,7 +1313,6 @@ struct SelectedItemsTable: NSViewRepresentable {
context.coordinator.applySelection(to: table)
}
}
(scrollView as? FinderTableScrollView)?.rebalanceColumnsToViewport()
}
}

Expand Down
Loading
Loading