diff --git a/.github/actions/package/action.yml b/.github/actions/package/action.yml
index c1c0d7f0..aca93b13 100644
--- a/.github/actions/package/action.yml
+++ b/.github/actions/package/action.yml
@@ -1,7 +1,7 @@
name: Package
description: >-
The packages of the release build already in target/release (NSIS on Windows; deb, AppImage and
- rpm on Linux), signed, each checked to hold the application alone, gathered with the standalone
+ rpm on Linux; a .dmg and the updater's archive on macOS), signed, each checked to hold the application alone, gathered with the standalone
executable into a folder.
inputs:
@@ -43,6 +43,25 @@ runs:
rm -rf "$packages"
if [ "$RUNNER_OS" = Windows ]; then
cargo packager -p app --release -f nsis -o "$packages"
+ elif [ "$RUNNER_OS" = macOS ]; then
+ # The runner's scanners can still hold the image when it is ejected: busy, free later.
+ for attempt in 1 2 3; do
+ cargo packager -p app --release -f app,dmg -o "$packages" && break
+ [ "$attempt" = 3 ] && exit 1
+ hdiutil detach /Volumes/DevNotes -force > /dev/null 2>&1 || true
+ rm -rf "$packages"
+ sleep 15
+ done
+ # One archive an architecture in a release: the packager names it after the application alone.
+ version=$(cargo metadata --format-version 1 --no-deps \
+ | jq -r '.packages[] | select(.name == "app") | .version')
+ arch=$([ "$RUNNER_ARCH" = ARM64 ] && echo aarch64 || echo x64)
+ for ending in dmg dmg.sig; do
+ mv "$packages/DevNotes_${version}_$arch.$ending" "$packages/devnotes_${version}_$arch.$ending"
+ done
+ for ending in app.tar.gz app.tar.gz.sig; do
+ mv "$packages/DevNotes.$ending" "$packages/devnotes_${version}_$arch.$ending"
+ done
else
cargo packager -p app --release -f deb,appimage -o "$packages"
version=$(cargo metadata --format-version 1 --no-deps \
@@ -75,6 +94,15 @@ runs:
pwsh -NoProfile -Command "Start-Process '$(cygpath -w "$scratch/uninstall.exe")' -ArgumentList '/S' -Wait"
# The uninstaller leaves the remembered folder behind; a later install would reuse it.
reg delete 'HKCU\Software\vmillet-dev\DevNotes' //f > /dev/null 2>&1 || true
+ elif [ "$RUNNER_OS" = macOS ]; then
+ codesign --verify --deep --strict "$packages/DevNotes.app"
+ archive=$(ls "$packages"/*.app.tar.gz)
+ check archive "$(tar -tzf "$archive" | grep '/Contents/MacOS/[^/]' | xargs -n1 basename)" devnotes
+ mounted="$RUNNER_TEMP/dmg-check"
+ # The image shows the licence first; `yes` ends on a closed pipe.
+ { yes 2> /dev/null || true; } | PAGER=cat hdiutil attach -nobrowse -readonly -mountpoint "$mounted" "$(ls "$packages"/*.dmg)" > /dev/null
+ check dmg "$(ls "$mounted/DevNotes.app/Contents/MacOS")" devnotes
+ hdiutil detach "$mounted" > /dev/null
else
deb=$(ls "$packages"/*.deb)
check deb "$(dpkg-deb -c "$deb" | awk '$6 ~ /^\.?\/?usr\/bin\/[^\/]+$/ { n = split($6, p, "/"); print p[n] }')" devnotes
@@ -97,11 +125,11 @@ runs:
| jq -r '.packages[] | select(.name == "app") | .version')
mkdir -p "$OUT"
find "$packages" -maxdepth 1 -type f \
- \( -name '*-setup.exe' -o -name '*.deb' -o -name '*.rpm' -o -name '*.AppImage' -o -name '*.sig' \) \
+ \( -name '*-setup.exe' -o -name '*.deb' -o -name '*.rpm' -o -name '*.AppImage' -o -name '*.dmg' -o -name '*.app.tar.gz' -o -name '*.sig' \) \
-exec cp {} "$OUT/" \;
if [ "$RUNNER_OS" = Windows ]; then
cp target/release/devnotes.exe "$OUT/devnotes-$version-windows.exe"
- else
+ elif [ "$RUNNER_OS" = Linux ]; then
cp target/release/devnotes "$OUT/devnotes-$version-linux"
fi
ls -l "$OUT"
diff --git a/.github/scripts/installed.sh b/.github/scripts/installed.sh
index 501f02d0..9f253b6a 100755
--- a/.github/scripts/installed.sh
+++ b/.github/scripts/installed.sh
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
# Whether version $1 is the one installed by `packages.yml`: the AppImage in place is that
-# version's file (Linux), or the per-user install says that version (Windows). An update under
-# Windows finishes in an installer of its own: waited for, two minutes at most.
+# version's file (Linux), the application says that version and is whole (macOS), or the per-user
+# install says it (Windows). An update under Windows finishes in an installer of its own: waited for,
+# two minutes at most.
set -euo pipefail
expected=$1
case "$expected" in
@@ -22,6 +23,17 @@ if [ "$RUNNER_OS" = Linux ]; then
exit 0
fi
+if [ "$RUNNER_OS" = macOS ]; then
+ app="$RUNNER_TEMP/installed/DevNotes.app"
+ found=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$app/Contents/Info.plist")
+ if [ "$found" != "$expected" ] || [ ! -x "$app/Contents/MacOS/devnotes" ]; then
+ echo "::error::the application in place is '$found', expected $expected"
+ exit 1
+ fi
+ echo "installed: $expected"
+ exit 0
+fi
+
# The uninstall entry the NSIS installer writes under HKCU, a field of it.
entry() {
pwsh -NoProfile -Command "(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' -ErrorAction SilentlyContinue | Where-Object DisplayName -eq 'DevNotes').$1" | tr -d '\r"'
diff --git a/.github/scripts/largest-screen.swift b/.github/scripts/largest-screen.swift
new file mode 100644
index 00000000..e0712668
--- /dev/null
+++ b/.github/scripts/largest-screen.swift
@@ -0,0 +1,23 @@
+// A macOS runner's screen is smaller than the window the scenarios resize, and AppKit keeps a
+// window inside its screen: the largest mode the display offers, for the session.
+import CoreGraphics
+
+let display = CGMainDisplayID()
+let options = [kCGDisplayShowDuplicateLowResolutionModes: kCFBooleanTrue] as CFDictionary
+let modes = CGDisplayCopyAllDisplayModes(display, options) as? [CGDisplayMode] ?? []
+for mode in modes {
+ print("\(mode.width)x\(mode.height), drawn at \(mode.pixelWidth)x\(mode.pixelHeight)")
+}
+
+func area(_ mode: CGDisplayMode) -> Int { mode.width * mode.height }
+guard let largest = modes.max(by: { area($0) < area($1) }) else {
+ fatalError("the display names no mode")
+}
+
+// `CGDisplaySetDisplayMode` would last as long as this script.
+var configuration: CGDisplayConfigRef?
+CGBeginDisplayConfiguration(&configuration)
+CGConfigureDisplayWithDisplayMode(configuration, display, largest, nil)
+let result = CGCompleteDisplayConfiguration(configuration, .forSession)
+print("taken: \(largest.width)x\(largest.height), \(result == .success ? "done" : "refused")")
+print("now: \(CGDisplayBounds(display).size)")
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1760d1d4..021d7774 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -192,7 +192,7 @@ jobs:
strategy:
fail-fast: true
matrix:
- os: [ubuntu-22.04, windows-latest]
+ os: [ubuntu-22.04, windows-latest, macos-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
@@ -225,7 +225,7 @@ jobs:
echo "\`test-rust\` (${{ matrix.os }}) — $(($(date +%s) - start)) s" >> "$GITHUB_STEP_SUMMARY"
- name: Test
- if: runner.os == 'Windows'
+ if: runner.os != 'Linux'
run: |
start=$(date +%s)
@@ -313,7 +313,7 @@ jobs:
strategy:
fail-fast: true
matrix:
- os: [ubuntu-22.04, windows-latest]
+ os: [ubuntu-22.04, windows-latest, macos-latest]
# The flavour in `target/debug`, where the cache is: nothing else builds `app` in this job.
env:
@@ -333,6 +333,10 @@ jobs:
if: runner.os == 'Linux'
run: sudo apt-get install -y --no-install-recommends xvfb
+ - name: A screen larger than the window
+ if: runner.os == 'macOS'
+ run: swift .github/scripts/largest-screen.swift
+
- name: Build the flavour
run: cargo build -p app --features e2e --locked
@@ -354,7 +358,8 @@ jobs:
{
echo "\`e2e\` (${{ matrix.os }}) — $(($(date +%s) - start)) s"
echo
- sed 's/\x1b\[[0-9;]*m//g' "$output" | awk '
+ # perl: macOS's sed knows no \x1b.
+ perl -pe 's/\x1b\[[0-9;]*m//g' "$output" | awk '
match($0, /tests.[0-9a-z_]+\.rs/) { name = substr($0, RSTART + 6, RLENGTH - 9); order[++n] = name; next }
/Doc-tests/ { name = "" }
/^▶ / { steps[name]++ }
@@ -365,7 +370,7 @@ jobs:
for (i = 1; i <= n; i++) {
k = order[i]
sub(/\.$/, "", result[k])
- printf "| `%s` | %d | %s | %s |\n", k, steps[k], result[k] == "" ? "not run" : result[k], time[k]
+ printf "| `%s` | %d | %s | %s |\n", k, steps[k], (result[k] == "" ? "not run" : result[k]), time[k]
}
}'
} >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml
index dfe8febd..63ae945d 100644
--- a/.github/workflows/packages.yml
+++ b/.github/workflows/packages.yml
@@ -41,7 +41,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-22.04, windows-latest]
+ os: [ubuntu-22.04, windows-latest, macos-latest, macos-15-intel]
env:
SERVED: ${{ github.workspace }}/served
ORIGIN: http://127.0.0.1:8765
@@ -77,7 +77,7 @@ jobs:
# The one line of `[workspace.package]` that starts with `version`; Cargo.lock follows.
- name: Version 1.0.0
- run: sed -i 's/^version = ".*"/version = "1.0.0"/' Cargo.toml && cargo metadata --format-version 1 > /dev/null
+ run: perl -pi -e 's/^version = ".*"/version = "1.0.0"/' Cargo.toml && cargo metadata --format-version 1 > /dev/null
- uses: ./.github/actions/package
with:
@@ -86,7 +86,7 @@ jobs:
out: old
- name: Version 1.0.1
- run: sed -i 's/^version = ".*"/version = "1.0.1"/' Cargo.toml && cargo metadata --format-version 1 > /dev/null
+ run: perl -pi -e 's/^version = ".*"/version = "1.0.1"/' Cargo.toml && cargo metadata --format-version 1 > /dev/null
- uses: ./.github/actions/package
with:
@@ -103,7 +103,7 @@ jobs:
mkdir -p "$SERVED/$kind"
cp new/* "$SERVED/$kind/"
# The manifest script refuses a release without Windows: a stand-in, never fetched.
- if [ "$RUNNER_OS" = Linux ]; then
+ if [ "$RUNNER_OS" != Windows ]; then
echo stand-in > "$SERVED/$kind/devnotes_1.0.1_x64-setup.exe"
echo stand-in > "$SERVED/$kind/devnotes_1.0.1_x64-setup.exe.sig"
fi
@@ -112,6 +112,8 @@ jobs:
done
if [ "$RUNNER_OS" = Windows ]; then
package=$(ls "$SERVED/altered" | grep -- '-setup\.exe$')
+ elif [ "$RUNNER_OS" = macOS ]; then
+ package=$(ls "$SERVED/altered" | grep '\.app\.tar\.gz$')
else
package=$(ls "$SERVED/altered" | grep '\.AppImage$')
fi
@@ -126,6 +128,12 @@ jobs:
run: |
if [ "$RUNNER_OS" = Windows ]; then
pwsh -NoProfile -Command "Start-Process '$(cygpath -w "$(ls old/*-setup.exe)")' -ArgumentList '/S' -Wait"
+ elif [ "$RUNNER_OS" = macOS ]; then
+ # Copied from the image, as a person drags it.
+ mkdir -p "$RUNNER_TEMP/installed"
+ { yes 2> /dev/null || true; } | PAGER=cat hdiutil attach -nobrowse -readonly -mountpoint "$RUNNER_TEMP/image" "$(ls old/*.dmg)" > /dev/null
+ ditto "$RUNNER_TEMP/image/DevNotes.app" "$RUNNER_TEMP/installed/DevNotes.app"
+ hdiutil detach "$RUNNER_TEMP/image" > /dev/null
else
mkdir -p "$RUNNER_TEMP/installed"
cp old/*.AppImage "$RUNNER_TEMP/installed/DevNotes.AppImage"
@@ -133,10 +141,20 @@ jobs:
fi
.github/scripts/installed.sh 1.0.0
+ # What replaces a macOS application is found beside the executable that runs.
+ - name: The updater, where it runs from
+ run: |
+ updater=target/release/examples/update
+ if [ "$RUNNER_OS" = macOS ]; then
+ cp "$updater" "$RUNNER_TEMP/installed/DevNotes.app/Contents/MacOS/update"
+ updater="$RUNNER_TEMP/installed/DevNotes.app/Contents/MacOS/update"
+ fi
+ echo "UPDATER=$updater" >> "$GITHUB_ENV"
+
- name: The altered 1.0.1 is refused, 1.0.0 stays
run: |
set +e
- APPIMAGE="$RUNNER_TEMP/installed/DevNotes.AppImage" target/release/examples/update 1.0.0 \
+ APPIMAGE="$RUNNER_TEMP/installed/DevNotes.AppImage" "$UPDATER" 1.0.0 \
"$ORIGIN/altered/latest.json" '${{ steps.key.outputs.public }}'
status=$?
set -e
@@ -148,7 +166,7 @@ jobs:
- name: The whole 1.0.1 is installed
run: |
- APPIMAGE="$RUNNER_TEMP/installed/DevNotes.AppImage" target/release/examples/update 1.0.0 \
+ APPIMAGE="$RUNNER_TEMP/installed/DevNotes.AppImage" "$UPDATER" 1.0.0 \
"$ORIGIN/whole/latest.json" '${{ steps.key.outputs.public }}'
.github/scripts/installed.sh 1.0.1
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index bf7d3793..1bdd5ebe 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -215,6 +215,8 @@ jobs:
environment: release
runs-on: ${{ matrix.os }}
timeout-minutes: 60
+ # ⚠️ The tag is out by now: a macOS leg that fails must not leave it without a release.
+ continue-on-error: ${{ startsWith(matrix.target, 'macos') }}
defaults:
run:
shell: bash
@@ -228,6 +230,10 @@ jobs:
target: linux
- os: windows-latest
target: windows
+ - os: macos-latest
+ target: macos-aarch64
+ - os: macos-15-intel
+ target: macos-x64
steps:
# The SHA rather than the tag name: the tag was just created by `prepare`, and a SHA
# cannot come to mean something else in between.
diff --git a/CLAUDE.md b/CLAUDE.md
index 61c5bef1..ad81f39b 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -24,7 +24,7 @@ Principles:
- Node is only a build tool: `npm install` · `npm run lint` (Prettier over Markdown, JSON, YAML; `format` writes) · `npm run test:scripts` (⚠️ test files are named one by one in `package.json`; add new ones there) · `cargo run -p app --example icons` (writes `crates/app/icons/`; ⚠️ small `.ico` sizes come from `icons/source/`) · `npm run prettier` (copies the pinned Prettier into `crates/text/prettier/`, the formatter compiled in). The request-script libraries are bundled by `crates/engine/sandbox/build.mjs`, from that folder's own `package.json`.
- Website (`website/`, Angular, devnotes.fr; its own `package.json`, outside the Cargo workspace): from `website/`, `npm ci` · `npm start` (port 4300) · `npm run build` (fetches the latest release, prerenders to `website/dist/`, checks every page and its download links) · `npm test` · `npm run lint` · `npm run test:scripts`. `website.yml` publishes it when `website/` or `docs/content/` changes on `main`, and after each release. → "The website".
- E2E: `cargo build -p app --features e2e --target-dir target/e2e`, then `cargo test -p e2e` (the driver is `e2e/` at the root; all scenarios, one after the other; `--test 01_first_launch` for one; `cargo test --workspace --exclude e2e` otherwise). `01`–`35` are the WebdriverIO scenarios ported, the rest are this application's own. → "The scenarios, on the assembled window".
-- Release is a `workflow_dispatch` after a version bump; the version is `[workspace.package] version` in `Cargo.toml` alone (D27), so a bump touches `Cargo.toml` and `Cargo.lock` (`cargo update --workspace`); `scripts/version.mjs` refuses a release where they disagree. `release.yml` builds, packages (`cargo-packager`: NSIS, AppImage, deb; rpm by `cargo-generate-rpm`) and signs; `packages.yml` installs and updates them. ⚠️ A version branch (`dev/x.y.z`) reaches `main` by a merge commit, never a squash: the release notes read what the merge brings. → "Releasing", `docs/releasing.md`.
+- Release is a `workflow_dispatch` after a version bump; the version is `[workspace.package] version` in `Cargo.toml` alone (D27), so a bump touches `Cargo.toml` and `Cargo.lock` (`cargo update --workspace`); `scripts/version.mjs` refuses a release where they disagree. `release.yml` builds, packages (`cargo-packager`: NSIS, AppImage, deb, dmg; rpm by `cargo-generate-rpm`) and signs; `packages.yml` installs and updates them. ⚠️ A version branch (`dev/x.y.z`) reaches `main` by a merge commit, never a squash: the release notes read what the merge brings. → "Releasing", `docs/releasing.md`.
## Things that will bite you
diff --git a/README.md b/README.md
index f0ef3df1..5c865690 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Everything local, everything behind one passphrase.
[](https://github.com/vmillet-dev/devnotes-rs/releases/latest)
[](https://github.com/vmillet-dev/devnotes-rs/actions/workflows/ci.yml)
-[](#install)
+[](#install)
[](LICENSE)
[**Download**](https://github.com/vmillet-dev/devnotes-rs/releases/latest) · [Notes](#notes-and-snippets) · [Tools](#tools) · [API client](#api-client) · [Code quality](#code-quality) · [Install](#install) · [Privacy](#privacy)
@@ -52,7 +52,7 @@ HTTP, GraphQL and WebSocket. Collections, environments and variables, a history
-**Shared by all three:** local-first and encrypted · no account, no cloud, no telemetry · keyboard first · Windows and Linux.
+**Shared by all three:** local-first and encrypted · no account, no cloud, no telemetry · keyboard first · Windows, macOS and Linux.
## Code quality
@@ -106,12 +106,14 @@ Several libraries, each behind its own passphrase · a daily backup restored in
## Install
-DevNotes runs on **Windows** and **Linux**, as one native program: no browser engine, no runtime to install beside it. The Windows installer installs for you alone and needs no administrator rights. Take the file for your system from the [latest release](https://github.com/vmillet-dev/devnotes-rs/releases/latest):
+DevNotes runs on **Windows**, **macOS** and **Linux**, as one native program: no browser engine, no runtime to install beside it. The Windows installer installs for you alone and needs no administrator rights. Take the file for your system from the [latest release](https://github.com/vmillet-dev/devnotes-rs/releases/latest):
| Platform | File | Pick it if |
| -------- | ------------------------------------ | ------------------------------------------------ |
| Windows | `devnotes__x64-setup.exe` | you just want it installed — **the one to take** |
| Windows | `devnotes--windows.exe` | you want no installer at all |
+| macOS | `devnotes__aarch64.dmg` | a Mac with an Apple chip (M1 and later) |
+| macOS | `devnotes__x64.dmg` | a Mac with an Intel processor |
| Linux | `devnotes__x86_64.AppImage` | any distribution, nothing to install |
| Linux | `devnotes__amd64.deb` | Debian, Ubuntu and derivatives |
| Linux | `devnotes-.x86_64.rpm` | Fedora, RHEL and derivatives |
@@ -128,16 +130,16 @@ sudo dnf install ./devnotes-*.x86_64.rpm # Fedora and RHEL
-Choose **More info**, then **Run anyway**. The warning is about the publisher's identity, not the file: DevNotes has no code-signing certificate. Its updates are signed and verified before they install — the installer and the AppImage update themselves from inside the application; the `.deb` and `.rpm` are updated by your package manager — and every release publishes `SHA256SUMS.txt`.
+Choose **More info**, then **Run anyway**. The warning is about the publisher's identity, not the file: DevNotes has no code-signing certificate. Its updates are signed and verified before they install — the installer, the macOS application and the AppImage update themselves from inside the application; the `.deb` and `.rpm` are updated by your package manager — and every release publishes `SHA256SUMS.txt`.
-Why there is no macOS build
+macOS blocks it the first time
-It cannot be tested here, and Gatekeeper wants a paid Apple Developer account with no free way around it on recent versions.
+Open **System Settings**, **Privacy & Security**, then **Open Anyway**. DevNotes has no publisher certificate, which needs a paid Apple Developer account. The macOS files come with the version after 1.1.0.
diff --git a/crates/app/Cargo.toml b/crates/app/Cargo.toml
index f18acd0b..d0c9cd1a 100644
--- a/crates/app/Cargo.toml
+++ b/crates/app/Cargo.toml
@@ -30,6 +30,12 @@ icons = ["icons/32x32.png", "icons/128x128.png", "icons/icon.png", "icons/icon.i
[package.metadata.packager.nsis]
installer-mode = "currentUser"
+# Signed by nobody (« - »): a Mac with Apple Silicon starts no downloaded build that is not signed at
+# all. The packager makes the icon of the PNGs above.
+[package.metadata.packager.macos]
+signing-identity = "-"
+minimum-system-version = "11.0"
+
# GTK for the tray alone (D29); xkbcommon, Vulkan and the indicator are opened at run time.
[package.metadata.packager.deb]
package-name = "devnotes"
@@ -72,8 +78,8 @@ profiling = { workspace = true, optional = true }
puffin = { workspace = true, optional = true }
puffin_http = { workspace = true, optional = true }
-[target.'cfg(target_os = "linux")'.dependencies]
-# The one eframe uses, for its X11 switch (D15).
+[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
+# The one eframe uses, for its X11 switch (D15) and for macOS's menu bar.
winit.workspace = true
[dev-dependencies]
diff --git a/crates/app/src/main.rs b/crates/app/src/main.rs
index 2fc9625b..f1eb2fa0 100644
--- a/crates/app/src/main.rs
+++ b/crates/app/src/main.rs
@@ -97,8 +97,9 @@ fn run(locations: Locations, instance: Instance) -> eframe::Result {
{
log::warn!("Second launches will not be heard: {error}");
}
- let desktop = desktop::start(&preferences, &inbox);
- let startup = ui::Startup {
+ // ⚠️ Called with the event loop running: macOS makes no tray icon before.
+ let startup = move || ui::Startup {
+ desktop: desktop::start(&preferences, &inbox),
paths: engine::Paths {
profile: locations.profile,
},
@@ -109,18 +110,17 @@ fn run(locations: Locations, instance: Instance) -> eframe::Result {
inbox,
waker,
inputs,
- desktop,
};
eframe::run_native(
METADATA.name,
options(restored),
#[cfg(not(feature = "e2e"))]
- Box::new(move |cc| Ok(Box::new(ui::DevNotesApp::new(cc, startup)?))),
+ Box::new(move |cc| Ok(Box::new(ui::DevNotesApp::new(cc, startup())?))),
#[cfg(feature = "e2e")]
Box::new(move |cc| {
unpainted::attach(&cc.egui_ctx);
- Ok(Box::new(ui::DevNotesApp::new(cc, startup)?))
+ Ok(Box::new(ui::DevNotesApp::new(cc, startup())?))
}),
)
}
@@ -158,7 +158,7 @@ fn options(restored: Option) -> eframe::NativeOptions {
viewport,
centered: restored.is_none(),
persist_window: false,
- event_loop_builder: x11_when_possible(),
+ event_loop_builder: event_loop(),
wgpu_options: renderer::options(),
..Default::default()
}
@@ -167,7 +167,7 @@ fn options(restored: Option) -> eframe::NativeOptions {
/// D15: under native Wayland, winit 0.30 delivers no dropped file and cannot hide the window,
/// so X11 (`XWayland`) is taken whenever a display offers it.
#[cfg(target_os = "linux")]
-fn x11_when_possible() -> Option {
+fn event_loop() -> Option {
use winit::platform::x11::EventLoopBuilderExtX11;
std::env::var_os("DISPLAY")?;
@@ -176,8 +176,19 @@ fn x11_when_possible() -> Option {
}))
}
-#[cfg(not(target_os = "linux"))]
-fn x11_when_possible() -> Option {
+/// No menu bar of winit's: its « Quit » ends the process where it stands, with what is typed and
+/// unsaved. ⌘Q is the application's own key.
+#[cfg(target_os = "macos")]
+fn event_loop() -> Option {
+ use winit::platform::macos::EventLoopBuilderExtMacOS;
+
+ Some(Box::new(|builder| {
+ builder.with_default_menu(false);
+ }))
+}
+
+#[cfg(not(any(target_os = "linux", target_os = "macos")))]
+fn event_loop() -> Option {
None
}
diff --git a/crates/platform/src/instance.rs b/crates/platform/src/instance.rs
index 057bd4fb..f7509920 100644
--- a/crates/platform/src/instance.rs
+++ b/crates/platform/src/instance.rs
@@ -50,13 +50,30 @@ pub enum Claim {
Taken,
}
-pub struct Instance(Listener);
+pub struct Instance {
+ listener: Listener,
+ #[cfg(target_os = "macos")]
+ _lock: std::fs::File,
+}
/// Takes the profile's name, or finds it taken. Two profiles never share one.
pub fn claim(profile: &Path) -> io::Result {
let name = socket_name(profile)?.to_ns_name::()?;
- match ListenerOptions::new().name(name).create_sync() {
- Ok(listener) => Ok(Claim::First(Instance(listener))),
+ // ⚠️ macOS names a socket by a file, which a crash leaves behind: there a lock, which goes with
+ // the process, says who holds the profile, and a name left behind is taken over.
+ #[cfg(target_os = "macos")]
+ let Some(lock) = lock(profile)? else {
+ return Ok(Claim::Taken);
+ };
+ let options = ListenerOptions::new()
+ .name(name)
+ .try_overwrite(cfg!(target_os = "macos"));
+ match options.create_sync() {
+ Ok(listener) => Ok(Claim::First(Instance {
+ listener,
+ #[cfg(target_os = "macos")]
+ _lock: lock,
+ })),
// ⚠️ Windows answers a named pipe already created with « access denied », not
// « address in use ».
Err(error)
@@ -71,6 +88,21 @@ pub fn claim(profile: &Path) -> io::Result {
}
}
+/// `None` while another process holds it.
+#[cfg(target_os = "macos")]
+fn lock(profile: &Path) -> io::Result
diff --git a/website/src/app/download/download-page.ts b/website/src/app/download/download-page.ts
index 859395df..4d481ebe 100644
--- a/website/src/app/download/download-page.ts
+++ b/website/src/app/download/download-page.ts
@@ -3,7 +3,7 @@ import { RouterLink } from '@angular/router';
import { Lang, downloadPath } from '../core/lang';
import { Language } from '../core/language';
-import { CHECKSUMS, RELEASE_PAGE, System, VERSION, offers, visitorSystem } from '../core/release';
+import { CHECKSUMS, RELEASE_PAGE, System, VERSION, offers, systems, visitorSystem } from '../core/release';
import { Seo } from '../core/seo';
import { CHANGELOG } from '../core/site';
import { DocBlocks } from '../docs/doc-blocks';
@@ -20,11 +20,11 @@ const CHECK_COMMANDS = `sha256sum -c SHA256SUMS.txt --ignore-missing # Linux
Get-FileHash .\\devnotes_*_x64-setup.exe # Windows, PowerShell`;
const FR = {
- title: `Télécharger DevNotes ${VERSION} pour Windows et Linux`,
- description: `DevNotes ${VERSION} pour Windows et Linux : l'installateur, l'AppImage, les paquets .deb et .rpm, et les exécutables autonomes. Gratuit et libre.`,
+ title: `Télécharger DevNotes ${VERSION} pour ${systems('fr')}`,
+ description: `DevNotes ${VERSION} pour ${systems('fr')} : l'installateur, l'AppImage, les paquets .deb et .rpm, et les exécutables autonomes. Gratuit et libre.`,
label: 'Télécharger',
heading: 'Télécharger DevNotes',
- lede: `La version ${VERSION}, pour Windows et Linux. Gratuite et libre, sans compte : tout reste sur votre machine.`,
+ lede: `La version ${VERSION}, pour ${systems('fr')}. Gratuite et libre, sans compte : tout reste sur votre machine.`,
phone: "DevNotes s'installe sur un ordinateur. Ouvrez cette page depuis votre poste pour le télécharger.",
systems: 'Les fichiers, par système',
yours: 'Votre système',
@@ -34,11 +34,15 @@ const FR = {
executable: 'Rendez-la exécutable avec chmod +x, puis lancez-la.',
others: 'Autres formats',
notes: `Notes de la version ${VERSION}`,
- mac: "Pas de version macOS pour l'instant : elle ne peut pas être testée ici, et Gatekeeper réclame un compte Apple Developer payant.",
+ opening:
+ 'Au premier lancement, macOS le bloque : ouvrez Réglages Système, Confidentialité et sécurité, puis Ouvrir quand même.',
install: 'Installer',
onWindows: 'Sous Windows',
windows:
"Lancez l'installateur : il s'installe pour votre compte, sans droits d'administrateur. L'avertissement de SmartScreen porte sur l'éditeur, DevNotes n'ayant pas de certificat de signature de code, pas sur le fichier : son empreinte est plus bas.",
+ onMacos: 'Sous macOS',
+ macos:
+ "Ouvrez l'image et glissez DevNotes dans Applications. Au premier lancement, macOS le bloque, DevNotes n'ayant pas de certificat d'éditeur : ouvrez Réglages Système, Confidentialité et sécurité, puis Ouvrir quand même.",
onLinux: 'Sous Linux',
linux:
"Une AppImage se rend exécutable puis se lance ; un paquet s'installe avec le gestionnaire de la distribution.",
@@ -60,11 +64,11 @@ const FR = {
};
const EN: typeof FR = {
- title: `Download DevNotes ${VERSION} for Windows and Linux`,
- description: `DevNotes ${VERSION} for Windows and Linux: the installer, the AppImage, the .deb and .rpm packages, and the standalone executables. Free and open source.`,
+ title: `Download DevNotes ${VERSION} for ${systems('en')}`,
+ description: `DevNotes ${VERSION} for ${systems('en')}: the installer, the AppImage, the .deb and .rpm packages, and the standalone executables. Free and open source.`,
label: 'Download',
heading: 'Download DevNotes',
- lede: `Version ${VERSION}, for Windows and Linux. Free and open source, no account: everything stays on your machine.`,
+ lede: `Version ${VERSION}, for ${systems('en')}. Free and open source, no account: everything stays on your machine.`,
phone: 'DevNotes installs on a computer. Open this page from your desktop to download it.',
systems: 'The files, by system',
yours: 'Your system',
@@ -74,11 +78,14 @@ const EN: typeof FR = {
executable: 'Make it executable with chmod +x, then run it.',
others: 'Other formats',
notes: `Release notes for ${VERSION}`,
- mac: 'No macOS version for now: it cannot be tested here, and Gatekeeper requires a paid Apple Developer account.',
+ opening: 'On first launch, macOS blocks it: open System Settings, Privacy & Security, then Open Anyway.',
install: 'Installing',
onWindows: 'On Windows',
windows:
"Run the installer: it installs for your account, without administrator rights. SmartScreen's warning is about the publisher, DevNotes having no code signing certificate, not about the file: its fingerprint is below.",
+ onMacos: 'On macOS',
+ macos:
+ 'Open the image and drag DevNotes to Applications. On first launch, macOS blocks it, DevNotes having no publisher certificate: open System Settings, Privacy & Security, then Open Anyway.',
onLinux: 'On Linux',
linux:
"An AppImage is made executable then run; a package installs with the distribution's package manager.",
@@ -116,6 +123,7 @@ export class DownloadPage {
protected readonly files = computed(() =>
this.offers().flatMap((offer) => [offer.primary, ...offer.others]),
);
+ protected readonly hasMacos = this.offers().some(({ system }) => system === 'macos');
protected readonly startPath = computed(() => docPath('start', this.lang()));
protected readonly linuxInstall = computed(() => [shell(this.text().linuxTitle, LINUX_COMMANDS)]);
protected readonly check = computed(() => [shell(this.text().checkTitle, CHECK_COMMANDS)]);
@@ -142,4 +150,10 @@ export class DownloadPage {
this.onPhone.set(/Android|iPhone|iPad|iPod/i.test(navigator.userAgent));
});
}
+
+ /** What the first launch asks. */
+ protected headsUp(system: System): string {
+ const { unsigned, opening, executable } = this.text();
+ return { windows: unsigned, macos: opening, linux: executable }[system];
+ }
}
diff --git a/website/src/app/home/home-page.ts b/website/src/app/home/home-page.ts
index 08b54649..df2c2adc 100644
--- a/website/src/app/home/home-page.ts
+++ b/website/src/app/home/home-page.ts
@@ -14,7 +14,7 @@ import { clamp, field } from '../core/browser';
import { Lang, downloadPath, homePath } from '../core/lang';
import { Language } from '../core/language';
import { PageProgress, ProgressSegment } from '../core/page-progress';
-import { System, VERSION, offers, visitorSystem } from '../core/release';
+import { System, VERSION, offers, systems, visitorSystem } from '../core/release';
import { ScrollFrame } from '../core/scroll-frame';
import { Seo } from '../core/seo';
import { REPOSITORY, absolute } from '../core/site';
@@ -98,7 +98,7 @@ const FR = {
sections: ['Snippets', 'Ranger', 'Code', 'Outils', 'Client API', 'Chiffrement', 'Et aussi'],
closing: 'Vos snippets, rangés et à portée de raccourci.',
closingLede: (version: string) =>
- `DevNotes ${version}, pour Windows et Linux. Gratuit, libre, et rien ne quitte votre machine.`,
+ `DevNotes ${version}, pour ${systems('fr')}. Gratuit, libre, et rien ne quitte votre machine.`,
closingDownload: 'Télécharger DevNotes',
};
@@ -170,7 +170,7 @@ const EN: typeof FR = {
sections: ['Snippets', 'Organise', 'Code', 'Tools', 'API client', 'Encryption', 'And more'],
closing: 'Your snippets, filed and one shortcut away.',
closingLede: (version: string) =>
- `DevNotes ${version}, for Windows and Linux. Free, open source, and nothing leaves your machine.`,
+ `DevNotes ${version}, for ${systems('en')}. Free, open source, and nothing leaves your machine.`,
closingDownload: 'Download DevNotes',
};
@@ -240,7 +240,9 @@ export class HomePage {
'@type': 'SoftwareApplication',
name: 'DevNotes',
applicationCategory: 'DeveloperApplication',
- operatingSystem: 'Windows, Linux',
+ operatingSystem: offers(lang)
+ .map(({ label }) => label)
+ .join(', '),
softwareVersion: VERSION,
url: absolute(homePath(lang)),
downloadUrl: absolute(downloadPath(lang)),