Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Windows: an entry and a taskbar button for each app, and a jump list

Yashwanth Kamireddi99a400a72300
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 08dd844..b5a47e1 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -4,6 +4,8 @@
# per-user .exe installer from the same compiled crates. One compile, not two;
# 2. smoke — the .exe installed silently, Skykeep launched, its window seen on screen, and a
# screenshot kept, so an installer that cannot even start is never handed over;
+# then each app's Start-menu entry and window checked for its own app ID, the jump
+# list's tasks found, and the uninstaller seen to take every entry away;
# ui — every interface suite in Edge, only when asked for: Edge is the Chromium engine
# ci.yml already runs every suite in on each push.
# Run by hand (Actions → Windows build → Run workflow) or by a release (release.yml); never on
@@ -166,7 +168,7 @@ jobs:
with:
name: skykeep-windows
path: dist
- - name: Install, launch, and see the window
+ - name: Install, launch, see the window, the six apps, the jump list, uninstall
shell: pwsh
run: |
$setup = Get-ChildItem dist -Recurse -Filter *-setup.exe | Select-Object -First 1
@@ -180,6 +182,20 @@ jobs:
$entry = Get-StartApps | Where-Object { $_.Name -eq "Skykeep" } | Select-Object -First 1
if (-not $entry -or $entry.AppID -ne "io.github.yashwanthkamireddi.Skykeep") { throw "Start menu entry has app ID '$($entry.AppID)', not io.github.yashwanthkamireddi.Skykeep" }
"start menu app ID: $($entry.AppID)"
+ # Each app its own Start-menu entry beside it (packaging/windows/installer-hooks.nsh):
+ # "Skykeep Notes" opens Notes on its own, under that app's own ID — the one its window
+ # says (taskbar.rs), so Windows gives it a taskbar button of its own.
+ $apps = [ordered]@{ Notes = "notes"; Reminders = "reminders"; Calendar = "calendar"; Contacts = "contacts"; Drive = "drive"; Photos = "photos" }
+ $shell = New-Object -ComObject WScript.Shell
+ $programs = [Environment]::GetFolderPath("Programs")
+ foreach ($name in $apps.Keys) {
+ $want = "io.github.yashwanthkamireddi.Skykeep.$name"
+ $app = Get-StartApps | Where-Object { $_.Name -eq "Skykeep $name" } | Select-Object -First 1
+ if (-not $app -or $app.AppID -ne $want) { throw "Start menu entry 'Skykeep $name' has app ID '$($app.AppID)', not $want" }
+ $lnk = $shell.CreateShortcut("$programs\Skykeep $name.lnk")
+ if ($lnk.TargetPath -ne $exe.FullName -or $lnk.Arguments -ne "--app $($apps[$name])") { throw "'Skykeep $name' runs '$($lnk.TargetPath) $($lnk.Arguments)'" }
+ "start menu: Skykeep $name, $($lnk.Arguments), $($app.AppID)"
+ }
# Every visible top-level window the process owns, by title. MainWindowTitle names only
# one of them, and that may be the hidden single-instance window ("…-siw").
Add-Type -Namespace Win -Name U -MemberDefinition '
@@ -199,6 +215,39 @@ jobs:
$true }, [System.IntPtr]::Zero) | Out-Null
$found
}
+ # A window's own app ID, as the taskbar reads it.
+ Add-Type -TypeDefinition '
+ using System; using System.Runtime.InteropServices;
+ namespace WinShell {
+ [StructLayout(LayoutKind.Sequential)] public struct PropKey { public Guid fmtid; public uint pid; }
+ [StructLayout(LayoutKind.Sequential)] public struct PropVar { public ushort vt, r1, r2, r3; public IntPtr p, p2; }
+ [ComImport, Guid("886D8EEB-8CF2-4446-8D02-CDBA1DBDCF99"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IPropertyStore {
+ void GetCount(out uint count); void GetAt(uint i, out PropKey key); void GetValue(ref PropKey key, out PropVar v);
+ void SetValue(ref PropKey key, ref PropVar v); void Commit();
+ }
+ public static class Aumid {
+ [DllImport("shell32.dll")] static extern int SHGetPropertyStoreForWindow(IntPtr hwnd, ref Guid iid, [MarshalAs(UnmanagedType.Interface)] out IPropertyStore store);
+ public static string Of(IntPtr hwnd) {
+ Guid iid = typeof(IPropertyStore).GUID; IPropertyStore store;
+ if (SHGetPropertyStoreForWindow(hwnd, ref iid, out store) != 0) return null;
+ PropKey key = new PropKey { fmtid = new Guid("9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3"), pid = 5 };
+ PropVar v; store.GetValue(ref key, out v); Marshal.ReleaseComObject(store);
+ return (v.vt == 31 || v.vt == 8) ? Marshal.PtrToStringUni(v.p) : null;
+ }
+ }
+ }'
+ function Find-Window([int]$procId, [string]$title) {
+ $found = New-Object System.Collections.Generic.List[System.IntPtr]
+ [Win.U]::EnumWindows({ param($h, $l)
+ $owner = 0; [void][Win.U]::GetWindowThreadProcessId($h, [ref]$owner)
+ if ($owner -eq $procId -and [Win.U]::IsWindowVisible($h)) {
+ $sb = New-Object System.Text.StringBuilder 256; [void][Win.U]::GetWindowText($h, $sb, 256)
+ if ($sb.ToString() -eq $title) { $found.Add($h) }
+ }
+ $true }, [System.IntPtr]::Zero) | Out-Null
+ $found | Select-Object -First 1
+ }
$p = Start-Process $exe.FullName -PassThru
$titles = @()
for ($i = 0; $i -lt 30 -and -not ($titles -contains "Skykeep"); $i++) {
@@ -215,7 +264,45 @@ jobs:
[System.Drawing.Graphics]::FromImage($bmp).CopyFromScreen($b.Location, [System.Drawing.Point]::Empty, $b.Size)
$bmp.Save("$PWD\skykeep-on-windows.png")
if ($p.HasExited) { throw "Skykeep closed by itself" }
+ # Launched as its Start-menu entry and its jump-list task launch it — a second Skykeep,
+ # handing its command line to the one running — each app's window is its own, under
+ # its own app ID. `--new event` is Calendar's window with an event started.
+ foreach ($launch in @(@("--app notes", "Notes"), @("--new event", "Calendar"))) {
+ Start-Process $exe.FullName -ArgumentList $launch[0]
+ $h = $null
+ for ($i = 0; $i -lt 15 -and -not $h; $i++) { Start-Sleep -Seconds 2; $h = Find-Window $p.Id $launch[1] }
+ if (-not $h) { throw "skykeep $($launch[0]): no $($launch[1]) window after 30 s (visible: '$((Get-Titles $p.Id) -join "', '")')" }
+ $id = [WinShell.Aumid]::Of($h)
+ $want = "io.github.yashwanthkamireddi.Skykeep.$($launch[1])"
+ if ($id -ne $want) { throw "the $($launch[1]) window has app ID '$id', not $want" }
+ "skykeep $($launch[0]): $($launch[1]) window, app ID $id"
+ }
+ # The jump list, written by Skykeep as it starts: every task's command line is in one of
+ # the lists the shell keeps (UTF-16 inside a binary file, so matched byte for byte).
+ $latin = [System.Text.Encoding]::GetEncoding(28591)
+ $lists = Get-ChildItem "$env:APPDATA\Microsoft\Windows\Recent\CustomDestinations" -Filter *.customDestinations-ms -ErrorAction SilentlyContinue |
+ ForEach-Object { $latin.GetString([System.IO.File]::ReadAllBytes($_.FullName)) }
+ if (-not $lists) { throw "no jump list was written" }
+ $tasks = @("--new note", "--new reminder", "--new event") + ($apps.Values | ForEach-Object { "--app $_" })
+ foreach ($task in $tasks) {
+ $needle = $latin.GetString([System.Text.Encoding]::Unicode.GetBytes($task))
+ if (-not ($lists | Where-Object { $_.Contains($needle) })) { throw "the jump list has no '$task' task" }
+ }
+ "jump list: $($tasks -join ', ')"
Stop-Process -Id $p.Id
+ Start-Sleep -Seconds 2
+ # Uninstalled, every entry goes with it. The uninstaller hands itself to a copy and
+ # returns at once, so the Start menu is watched rather than the process waited on.
+ Start-Process (Join-Path $exe.DirectoryName "uninstall.exe") -ArgumentList "/S" -Wait
+ $left = @()
+ for ($i = 0; $i -lt 30; $i++) {
+ $left = @(Get-ChildItem $programs -Filter "Skykeep*.lnk" -ErrorAction SilentlyContinue)
+ if (-not $left -and -not (Test-Path $exe.FullName)) { break }
+ Start-Sleep -Seconds 1
+ }
+ if ($left) { throw "uninstalled, but the Start menu still has: $($left.Name -join ', ')" }
+ if (Test-Path $exe.FullName) { throw "uninstalled, but skykeep.exe is still there" }
+ "uninstalled: no Skykeep entries left in the Start menu"
- uses: actions/upload-artifact@v4
if: always()
with:
diff --git a/.uiverify/calendar-new-event.mjs b/.uiverify/calendar-new-event.mjs
new file mode 100644
index 0000000..6bd9d14
--- /dev/null
+++ b/.uiverify/calendar-new-event.mjs
@@ -0,0 +1,47 @@
+// "New Event" from outside the window — the taskbar's jump list, `skykeep --new event`
+// (src-tauri/src/apps.rs): a Calendar window made for it opens with a new event started; one
+// already open, even on another app, is told, comes to Calendar and starts one.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub } from "./stub.mjs";
+
+const b = await engine.launch();
+let failures = 0;
+const ok = (pass, msg) => { console.log(`${pass ? "PASS" : "FAIL"} ${msg}`); if (!pass) failures++; };
+const started = (page) => page.locator('.cx-popover input[placeholder="New Event"]').count();
+const stub = { screen: "library", services: SERVICES, twoFactor: null, calendarFixture: true, notesFixture: true };
+
+{
+ const ctx = await b.newContext({ viewport: { width: 1300, height: 850 } });
+ await ctx.addInitScript(installStub, stub);
+ const page = await ctx.newPage();
+ page.on("pageerror", (e) => { console.log(`FAIL page error: ${e.message}`); failures++; });
+ await page.goto("http://localhost:4173/?app=calendar&new=event", { waitUntil: "networkidle" });
+ await page.waitForTimeout(800);
+ ok((await page.locator('main.content[data-screen="calendar"]').count()) === 1, "a window made for it is Calendar");
+ ok((await started(page)) === 1, "with a new event started in it");
+ await ctx.close();
+}
+
+{
+ const ctx = await b.newContext({ viewport: { width: 1300, height: 850 } });
+ await ctx.addInitScript(installStub, stub);
+ const page = await ctx.newPage();
+ page.on("pageerror", (e) => { console.log(`FAIL page error: ${e.message}`); failures++; });
+ await page.goto("http://localhost:4173/?app=notes", { waitUntil: "networkidle" });
+ await page.waitForTimeout(800);
+ ok((await started(page)) === 0, "a window open on Notes has no event started");
+ // As Skykeep tells the open window (apps.rs, new_event).
+ await page.evaluate(() => window.__emit("quince://new-event", null));
+ await page.waitForTimeout(1000);
+ ok((await page.locator('main.content[data-screen="calendar"]').count()) === 1, "told, it comes to Calendar");
+ ok((await started(page)) === 1, "and starts a new event there");
+ await page.keyboard.press("Escape");
+ await page.waitForTimeout(300);
+ await page.evaluate(() => window.__emit("quince://new-event", null));
+ await page.waitForTimeout(600);
+ ok((await started(page)) === 1, "told again with Calendar built, it starts another");
+ await ctx.close();
+}
+
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/Cargo.lock b/Cargo.lock
index e0678c3..7685fd8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3885,6 +3885,7 @@ dependencies = [
"tokio",
"uuid",
"webkit2gtk",
+ "windows 0.62.2",
"wiremock",
"zbus 5.19.0",
]
diff --git a/packaging/README.md b/packaging/README.md
index 9f1780f..c233ed1 100644
--- a/packaging/README.md
+++ b/packaging/README.md
@@ -59,12 +59,29 @@ Calendar (`.ics`) and contact (`.vcf`) files open in Skykeep's import sheet
`.vcf`/`.vcard` in both the NSIS and MSI installers; Explorer passes the path on the command
line, and a second launch hands it to the running Skykeep (single instance).
-`skykeep --new reminder` and `skykeep --new note` open the quick-capture window. They are
-`Actions=` on the main entry and on the Reminders and Notes entries (right-click in a dock or
-launcher).
-
-**Windows jump-list tasks are not set up yet.** A jump list's tasks are written by the running
-app through the shell's `ICustomDestinationList` COM interface; neither Tauri nor its NSIS/MSI
-templates can declare them. Adding them means a Windows-only call at startup (`windows` crate,
-`Win32_UI_Shell`) registering two `IShellLink` tasks with the arguments above. Until then, the
-same commands work from a shortcut's Target field.
+`skykeep --new reminder` and `skykeep --new note` open the quick-capture window;
+`skykeep --new event` opens Calendar with a new event started. The first two are `Actions=` on
+the main entry and on the Reminders and Notes entries (right-click in a dock or launcher).
+
+## The six apps on Windows
+
+What the per-app `.desktop` files and `Actions=` are on Linux:
+
+- **Start menu:** beside "Skykeep", "Skykeep Notes", "Skykeep Reminders" and so on, each running
+ `skykeep.exe --app notes` (and so on). The `.exe` installer makes them in
+ `windows/installer-hooks.nsh` (`bundle.windows.nsis.installerHooks`), and removes them, unpinned,
+ on uninstall; the MSI makes the same six from `windows/app-shortcuts.wxs`
+ (`bundle.windows.wix.fragmentPaths`), in one component that its uninstall removes.
+- **Taskbar buttons:** each shortcut carries its app's AppUserModelID,
+ `io.github.yashwanthkamireddi.Skykeep.Notes` and so on, and each app's window says the same ID
+ at runtime (`src-tauri/src/taskbar.rs`), so Notes and Calendar get their own taskbar buttons
+ and pin as their own shortcuts. The process says Skykeep's own ID, the one Tauri stamps on
+ "Skykeep", so the main window, toasts and the jump list are Skykeep's.
+- **Jump list:** Skykeep writes it as it starts (`ICustomDestinationList`; no installer can
+ declare one): New Note, New Reminder, New Event, then the six apps. Notes', Reminders' and
+ Calendar's own buttons offer their own new item. Each task is one of the command lines above,
+ handed to the Skykeep already running.
+
+`.github/workflows/windows.yml` checks all of this after a silent install: each entry's app ID
+and command line, each app window's app ID, every jump-list task, and that uninstalling leaves no
+entry behind.
diff --git a/packaging/windows/app-shortcuts.wxs b/packaging/windows/app-shortcuts.wxs
new file mode 100644
index 0000000..75d84d3
--- /dev/null
+++ b/packaging/windows/app-shortcuts.wxs
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Skykeep's six apps in the Start menu, from the MSI: what installer-hooks.nsh makes for the
+ .exe installer. "Skykeep Notes" opens Notes on its own, as its Linux launcher entry does,
+ beside Tauri's own "Skykeep" in the same Start-menu folder; each is stamped with its app's
+ AppUserModelID (`<identifier>.Notes`, as its window says at runtime:
+ src-tauri/src/taskbar.rs). One component, so the MSI takes all six away again on uninstall.
+
+ Referenced from tauri.conf.json (bundle > windows > wix > fragmentPaths, componentRefs). The
+ ids it uses are Tauri's main.wxs's own: ApplicationProgramsFolder (the Start-menu folder),
+ Path (skykeep.exe), ProductIcon and INSTALLDIR.
+-->
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Fragment>
+ <DirectoryRef Id="ApplicationProgramsFolder">
+ <Component Id="SkykeepAppShortcuts" Guid="*">
+ <Shortcut Id="SkykeepNotesShortcut" Name="Skykeep Notes" Description="Notes from iCloud, on this computer"
+ Target="[!Path]" Arguments="--app notes" Icon="ProductIcon" WorkingDirectory="INSTALLDIR">
+ <ShortcutProperty Key="System.AppUserModel.ID" Value="io.github.yashwanthkamireddi.Skykeep.Notes"/>
+ </Shortcut>
+ <Shortcut Id="SkykeepRemindersShortcut" Name="Skykeep Reminders" Description="Reminders from iCloud, on this computer"
+ Target="[!Path]" Arguments="--app reminders" Icon="ProductIcon" WorkingDirectory="INSTALLDIR">
+ <ShortcutProperty Key="System.AppUserModel.ID" Value="io.github.yashwanthkamireddi.Skykeep.Reminders"/>
+ </Shortcut>
+ <Shortcut Id="SkykeepCalendarShortcut" Name="Skykeep Calendar" Description="Your iCloud calendars, on this computer"
+ Target="[!Path]" Arguments="--app calendar" Icon="ProductIcon" WorkingDirectory="INSTALLDIR">
+ <ShortcutProperty Key="System.AppUserModel.ID" Value="io.github.yashwanthkamireddi.Skykeep.Calendar"/>
+ </Shortcut>
+ <Shortcut Id="SkykeepContactsShortcut" Name="Skykeep Contacts" Description="Your iCloud contacts, on this computer"
+ Target="[!Path]" Arguments="--app contacts" Icon="ProductIcon" WorkingDirectory="INSTALLDIR">
+ <ShortcutProperty Key="System.AppUserModel.ID" Value="io.github.yashwanthkamireddi.Skykeep.Contacts"/>
+ </Shortcut>
+ <Shortcut Id="SkykeepDriveShortcut" Name="Skykeep Drive" Description="iCloud Drive, on this computer"
+ Target="[!Path]" Arguments="--app drive" Icon="ProductIcon" WorkingDirectory="INSTALLDIR">
+ <ShortcutProperty Key="System.AppUserModel.ID" Value="io.github.yashwanthkamireddi.Skykeep.Drive"/>
+ </Shortcut>
+ <Shortcut Id="SkykeepPhotosShortcut" Name="Skykeep Photos" Description="iCloud Photos, on this computer"
+ Target="[!Path]" Arguments="--app photos" Icon="ProductIcon" WorkingDirectory="INSTALLDIR">
+ <ShortcutProperty Key="System.AppUserModel.ID" Value="io.github.yashwanthkamireddi.Skykeep.Photos"/>
+ </Shortcut>
+ <RegistryValue Root="HKCU" Key="Software\Yashwanth Kamireddi\Skykeep" Name="App Shortcuts" Type="integer" Value="1" KeyPath="yes"/>
+ </Component>
+ </DirectoryRef>
+ </Fragment>
+</Wix>
diff --git a/packaging/windows/installer-hooks.nsh b/packaging/windows/installer-hooks.nsh
new file mode 100644
index 0000000..23881a4
--- /dev/null
+++ b/packaging/windows/installer-hooks.nsh
@@ -0,0 +1,106 @@
+; Skykeep's six apps in the Start menu beside Skykeep itself, as Linux has them in its launcher
+; (packaging/apps): "Skykeep Notes" runs `skykeep --app notes`, and so on — named with Skykeep
+; so typing "Notes" finds it and no other program's "Notes.lnk" is ever written over.
+;
+; Each shortcut carries its app's AppUserModelID, `<identifier>.Notes`, the one that app's
+; window says once open (src-tauri/src/taskbar.rs): Windows gives each app its own taskbar
+; button, and pins it as this shortcut. The "Skykeep" shortcut is Tauri's own, stamped with the
+; identifier.
+;
+; Included by Tauri's installer.nsi (tauri.conf.json, bundle > windows > nsis > installerHooks);
+; the MSI makes the same six from app-shortcuts.wxs. Every macro here is expanded inside that
+; script, so its defines (PRODUCTNAME, BUNDLEID, MAINBINARYNAME), variables and COM helpers
+; are there to use.
+
+; A shortcut's AppUserModelID: Tauri's SetLnkAppUserModelId, for an ID other than BUNDLEID.
+!macro SKYKEEP_LNK_APP_ID shortcut id
+ !insertmacro ComHlpr_CreateInProcInstance ${CLSID_ShellLink} ${IID_IShellLink} r0 ""
+ ${If} $0 P<> 0
+ ${IUnknown::QueryInterface} $0 '("${IID_IPersistFile}",.r1)'
+ ${If} $1 P<> 0
+ ${IPersistFile::Load} $1 '("${shortcut}", ${STGM_READWRITE})'
+ ${IUnknown::QueryInterface} $0 '("${IID_IPropertyStore}",.r2)'
+ ${If} $2 P<> 0
+ System::Call 'Oleaut32::SysAllocString(w "${id}") i.r3'
+ System::Call '*${SYSSTRUCT_PROPERTYKEY}(${PKEY_AppUserModel_ID})p.r4'
+ System::Call '*${SYSSTRUCT_PROPVARIANT}(${VT_BSTR},,&i4 $3)p.r5'
+ ${IPropertyStore::SetValue} $2 '($4,$5)'
+ System::Call 'Oleaut32::SysFreeString($3)'
+ System::Free $4
+ System::Free $5
+ ${IPropertyStore::Commit} $2 ""
+ ${IUnknown::Release} $2 ""
+ ${IPersistFile::Save} $1 '("${shortcut}",1)'
+ ${EndIf}
+ ${IUnknown::Release} $1 ""
+ ${EndIf}
+ ${IUnknown::Release} $0 ""
+ ${EndIf}
+!macroend
+
+; The folder Tauri puts "Skykeep" in, into $R9: the Start menu itself, unless a folder is
+; configured. Decided where the macro is used: this file is included before STARTMENUFOLDER is
+; defined.
+!macro SKYKEEP_MENU
+ !if "${STARTMENUFOLDER}" != ""
+ StrCpy $R9 "$SMPROGRAMS\$AppStartMenuFolder"
+ !else
+ StrCpy $R9 "$SMPROGRAMS"
+ !endif
+!macroend
+
+; One app's shortcut, in $R9: "Skykeep Notes", `skykeep --app notes`, Skykeep's icon, its own ID.
+!macro SKYKEEP_APP_SHORTCUT name arg comment
+ CreateShortcut "$R9\${PRODUCTNAME} ${name}.lnk" "$INSTDIR\${MAINBINARYNAME}.exe" "--app ${arg}" "$INSTDIR\${MAINBINARYNAME}.exe" 0 SW_SHOWNORMAL "" "${comment}"
+ !insertmacro SKYKEEP_LNK_APP_ID "$R9\${PRODUCTNAME} ${name}.lnk" "${BUNDLEID}.${name}"
+!macroend
+
+; One app's shortcut gone — unpinned first, and only if it is Skykeep's — with its jump list.
+!macro SKYKEEP_APP_SHORTCUT_GONE name
+ !insertmacro IsShortcutTarget "$R9\${PRODUCTNAME} ${name}.lnk" "$INSTDIR\${MAINBINARYNAME}.exe"
+ Pop $0
+ ${If} $0 = 1
+ !insertmacro UnpinShortcut "$R9\${PRODUCTNAME} ${name}.lnk"
+ Delete "$R9\${PRODUCTNAME} ${name}.lnk"
+ ${EndIf}
+ !insertmacro ComHlpr_CreateInProcInstance ${CLSID_DestinationList} ${IID_ICustomDestinationList} r1 ""
+ ${If} $1 P<> 0
+ ${ICustomDestinationList::DeleteList} $1 '("${BUNDLEID}.${name}")'
+ ${IUnknown::Release} $1 ""
+ ${EndIf}
+!macroend
+
+; After Tauri's own shortcuts, and on the same terms: not on an update or with /NS, but always
+; when moving over from the MSI.
+!macro NSIS_HOOK_POSTINSTALL
+ ${If} $WixMode = 1
+ ${OrIf} $UpdateMode <> 1
+ ${If} $NoShortcutMode <> 1
+ ${OrIf} $WixMode = 1
+ !insertmacro SKYKEEP_MENU
+ CreateDirectory "$R9"
+ !insertmacro SKYKEEP_APP_SHORTCUT "Notes" "notes" "Notes from iCloud, on this computer"
+ !insertmacro SKYKEEP_APP_SHORTCUT "Reminders" "reminders" "Reminders from iCloud, on this computer"
+ !insertmacro SKYKEEP_APP_SHORTCUT "Calendar" "calendar" "Your iCloud calendars, on this computer"
+ !insertmacro SKYKEEP_APP_SHORTCUT "Contacts" "contacts" "Your iCloud contacts, on this computer"
+ !insertmacro SKYKEEP_APP_SHORTCUT "Drive" "drive" "iCloud Drive, on this computer"
+ !insertmacro SKYKEEP_APP_SHORTCUT "Photos" "photos" "iCloud Photos, on this computer"
+ ${EndIf}
+ ${EndIf}
+!macroend
+
+; After Tauri has taken "Skykeep" away, and like it, kept on an update.
+!macro NSIS_HOOK_POSTUNINSTALL
+ ${If} $UpdateMode <> 1
+ !insertmacro SKYKEEP_MENU
+ !insertmacro SKYKEEP_APP_SHORTCUT_GONE "Notes"
+ !insertmacro SKYKEEP_APP_SHORTCUT_GONE "Reminders"
+ !insertmacro SKYKEEP_APP_SHORTCUT_GONE "Calendar"
+ !insertmacro SKYKEEP_APP_SHORTCUT_GONE "Contacts"
+ !insertmacro SKYKEEP_APP_SHORTCUT_GONE "Drive"
+ !insertmacro SKYKEEP_APP_SHORTCUT_GONE "Photos"
+ !if "${STARTMENUFOLDER}" != ""
+ RMDir "$R9"
+ !endif
+ ${EndIf}
+!macroend
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 4532c87..ede8bc3 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -44,6 +44,18 @@ tauri = { version = "2", features = ["tray-icon"] }
# Toasts with buttons on Windows (notify-rust sends none there): the same crate notify-rust uses.
[target.'cfg(windows)'.dependencies]
tauri-winrt-notification = "0.8"
+# Each app its own taskbar button and the jump list's tasks (taskbar.rs): the shell's own calls,
+# from the same build of the crate Tauri and the toasts already compile.
+windows = { version = "0.62", features = [
+ "Win32_Foundation",
+ "Win32_Storage_EnhancedStorage",
+ "Win32_System_Com",
+ "Win32_System_Com_StructuredStorage",
+ "Win32_System_Variant",
+ "Win32_UI_Shell",
+ "Win32_UI_Shell_Common",
+ "Win32_UI_Shell_PropertiesSystem",
+] }
[target.'cfg(target_os = "linux")'.dependencies]
fuser = { version = "0.18", default-features = false }
diff --git a/src-tauri/src/apps.rs b/src-tauri/src/apps.rs
index f8a4b8c..99fb01a 100644
--- a/src-tauri/src/apps.rs
+++ b/src-tauri/src/apps.rs
@@ -8,7 +8,7 @@
//! launcher entry — not six windows under one Skykeep icon. (Measured: GTK 3.24's
//! `gdk_wayland_window_set_application_id` sets it per window, within one process.)
-use tauri::{AppHandle, Manager, WebviewUrl, WebviewWindowBuilder};
+use tauri::{AppHandle, Emitter, Manager, WebviewUrl, WebviewWindowBuilder};
/// The apps: the key the window and the engine use, and the name a person sees.
pub const APPS: [(&str, &str); 6] = [
@@ -38,7 +38,27 @@ pub fn asked(args: &[String]) -> Option<&'static str> {
.map(|(key, _)| *key)
}
-/// What a quick-capture launcher action asks for: `--new reminder` or `--new note` (or
+/// What a command line names an app by: its key, but "drive" for Drive, as its launcher entry
+/// says it. `asked` takes either.
+#[cfg(any(windows, test))]
+pub fn launch_name(key: &str) -> &str {
+ if key == "drivews" {
+ "drive"
+ } else {
+ key
+ }
+}
+
+/// What can be started new from outside a window — a launcher action, the taskbar's jump list:
+/// the word after `--new`, what it is called, and the app it belongs to. A note and a reminder
+/// are the quick capture's (intake.rs); an event is Calendar's own, made in its window.
+pub const NEW: [(&str, &str, &str); 3] = [
+ ("note", "New Note", "notes"),
+ ("reminder", "New Reminder", "reminders"),
+ ("event", "New Event", "calendar"),
+];
+
+/// What a launcher action asks for: `--new reminder`, `--new note` or `--new event` (or
/// `--new=note`).
pub fn new_asked(args: &[String]) -> Option<&'static str> {
let named = args.iter().enumerate().find_map(|(i, a)| {
@@ -46,11 +66,9 @@ pub fn new_asked(args: &[String]) -> Option<&'static str> {
.map(ToString::to_string)
.or_else(|| (a == "--new").then(|| args.get(i + 1).cloned()).flatten())
})?;
- match named.as_str() {
- "reminder" => Some("reminder"),
- "note" => Some("note"),
- _ => None,
- }
+ NEW.iter()
+ .find(|(kind, _, _)| *kind == named)
+ .map(|(kind, _, _)| *kind)
}
/// The calendar and contact files a command line hands over — opened from a file manager,
@@ -126,6 +144,21 @@ fn label(key: &str) -> String {
format!("app-{key}")
}
+/// Told to Calendar's window to start a new event, as its own + button does.
+const NEW_EVENT: &str = "quince://new-event";
+
+/// "New Event" from outside the window (`skykeep --new event`, the taskbar's jump list):
+/// Calendar's window, with a new event started in it. A window being made is asked in its
+/// address; one already there is told.
+pub fn new_event(app: &AppHandle) {
+ if app.get_webview_window(&label("calendar")).is_some() {
+ open(app, "calendar");
+ app.emit_to(label("calendar").as_str(), NEW_EVENT, ()).ok();
+ } else {
+ make(app, "calendar", "&new=event");
+ }
+}
+
/// The app ID a window of `key` is known by: the app's own launcher entry's name, as the
/// desktop matches them (`<identifier>.Notes.desktop`).
pub fn app_id(app: &AppHandle, key: &str) -> String {
@@ -138,19 +171,25 @@ pub fn app_id(app: &AppHandle, key: &str) -> String {
/// The app's window, brought to the front, or made: its own window, showing that app alone.
pub fn open(app: &AppHandle, key: &str) {
- let Some((key, name)) = APPS.iter().find(|(k, _)| *k == key).copied() else {
- return;
- };
- crate::timing::mark(format_args!("app {key} asked"));
if let Some(w) = app.get_webview_window(&label(key)) {
+ crate::timing::mark(format_args!("app {key} asked"));
w.unminimize().ok();
show(&w);
return;
}
+ make(app, key, "");
+}
+
+/// The app's window made, hidden until drawn; `asking` is added to its address.
+fn make(app: &AppHandle, key: &str, asking: &str) {
+ let Some((key, name)) = APPS.iter().find(|(k, _)| *k == key).copied() else {
+ return;
+ };
+ crate::timing::mark(format_args!("app {key} asked"));
let made = WebviewWindowBuilder::new(
app,
label(key),
- WebviewUrl::App(format!("index.html?app={key}").into()),
+ WebviewUrl::App(format!("index.html?app={key}{asking}").into()),
)
.title(name)
.inner_size(1040.0, 720.0)
@@ -169,6 +208,9 @@ pub fn open(app: &AppHandle, key: &str) {
if crate::tiling_compositor() {
window.set_decorations(false).ok();
}
+ // On Windows, its own taskbar button, before it is ever shown (taskbar.rs).
+ #[cfg(windows)]
+ crate::taskbar::name_window(&window, key);
// Shown by its window_ready once drawn; if that never comes (a page slow to load, a
// keyring that does not answer), shown anyway — never a launch that opens nothing.
let w = window.clone();
@@ -217,6 +259,8 @@ pub fn put_away(window: &tauri::Window) {
.retain(|(l, _)| *l != label);
if let Some(w) = app.get_webview_window(&label) {
if !w.is_visible().unwrap_or(true) {
+ #[cfg(windows)]
+ crate::taskbar::unname_window(&w);
w.destroy().ok();
}
}
@@ -313,11 +357,31 @@ mod tests {
Some("reminder")
);
assert_eq!(new_asked(&args(&["skykeep", "--new=note"])), Some("note"));
- assert_eq!(new_asked(&args(&["skykeep", "--new", "event"])), None);
+ assert_eq!(
+ new_asked(&args(&["skykeep", "--new", "event"])),
+ Some("event")
+ );
+ assert_eq!(new_asked(&args(&["skykeep", "--new", "contact"])), None);
assert_eq!(new_asked(&args(&["skykeep", "--new"])), None);
assert_eq!(new_asked(&args(&["skykeep", "--app", "notes"])), None);
}
+ /// What a Start-menu shortcut or a jump-list task says on its command line (taskbar.rs,
+ /// packaging/windows) is what the parsers take: every app, and every new thing in its app.
+ #[test]
+ fn each_launch_line_reaches_what_it_names() {
+ for (key, _) in APPS {
+ assert_eq!(
+ asked(&args(&["skykeep", "--app", launch_name(key)])),
+ Some(key)
+ );
+ }
+ for (kind, _, key) in NEW {
+ assert_eq!(new_asked(&args(&["skykeep", "--new", kind])), Some(kind));
+ assert!(APPS.iter().any(|(k, _)| *k == key));
+ }
+ }
+
/// Windows paths and links, as Explorer and a browser hand them over.
#[cfg(windows)]
#[test]
diff --git a/src-tauri/src/intake.rs b/src-tauri/src/intake.rs
index e665204..c1f1009 100644
--- a/src-tauri/src/intake.rs
+++ b/src-tauri/src/intake.rs
@@ -1,5 +1,6 @@
//! What comes into Skykeep from outside its own windows: a calendar or contact file opened
-//! with it (`.ics`, `.vcf`) and the quick-capture launcher actions (`skykeep --new reminder`).
+//! with it (`.ics`, `.vcf`) and the launcher actions that start something new (`skykeep --new
+//! reminder`).
//!
//! A file is read here, on this computer, and nothing is sent anywhere until the person says
//! so in the import sheet: what it holds is shown first — the events with their days and
@@ -101,7 +102,13 @@ pub struct ImportContact {
/// it would have opened anyway.
pub fn arrived(app: &AppHandle, args: &[String], cwd: &Path) -> bool {
if let Some(kind) = crate::apps::new_asked(args) {
- capture(app, kind);
+ // An event is made in Calendar's own window, with its days and times; the others in
+ // the one-field capture.
+ if kind == "event" {
+ crate::apps::new_event(app);
+ } else {
+ capture(app, kind);
+ }
return true;
}
let files = crate::apps::files_asked(args, cwd);
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index b2849c5..5af0cbc 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -47,6 +47,9 @@ mod reminders_cmds;
#[cfg(target_os = "linux")]
mod search_provider;
mod settings;
+// Each app its own taskbar button on Windows, and the jump list's tasks.
+#[cfg(windows)]
+mod taskbar;
mod timing;
mod video;
@@ -5630,6 +5633,10 @@ fn main() {
if identifier != current {
context.config_mut().identifier = identifier;
}
+ // On Windows, before any window: everything from here on is Skykeep's on the taskbar, as
+ // its Start-menu shortcut is, and the jump list is written (taskbar.rs).
+ #[cfg(windows)]
+ taskbar::claim(&current);
// The name the desktop knows the main window by: on Wayland GTK sends the program name as
// the window's app ID, which was the binary's ("quince-app") — so a taskbar or dock could
// not match it to Skykeep's launcher entry, its name or its icon. Named for the identifier,
diff --git a/src-tauri/src/taskbar.rs b/src-tauri/src/taskbar.rs
new file mode 100644
index 0000000..453f4f8
--- /dev/null
+++ b/src-tauri/src/taskbar.rs
@@ -0,0 +1,252 @@
+//! Skykeep's six apps on the Windows taskbar and Start menu, as Linux has them in its launcher
+//! (apps.rs, packaging/apps): each app's window a taskbar button of its own, and the jump list's
+//! tasks — New Note, New Reminder, New Event, and the six apps.
+//!
+//! Windows groups windows by AppUserModelID. The process says Skykeep's, the identifier, which
+//! the installer stamps on the "Skykeep" Start-menu shortcut; each app's window says its own,
+//! `<identifier>.Notes` and so on — Microsoft's "SubProduct", a separate taskbar button per
+//! subapplication — which the installer stamps on that app's own shortcut
+//! (packaging/windows). A window with the same ID as a shortcut is pinned as that shortcut;
+//! one with none to match is pinned by the relaunch command it carries here.
+//!
+//! A jump list's tasks are written by the running app; no installer can declare them. Each is
+//! a command line the app already takes (`--new note`, `--app notes`), handed by the single
+//! instance to the Skykeep already running.
+
+use std::sync::OnceLock;
+
+use windows::core::{Interface, HSTRING, PWSTR};
+use windows::Win32::Foundation::PROPERTYKEY;
+use windows::Win32::Storage::EnhancedStorage::{
+ PKEY_AppUserModel_ID, PKEY_AppUserModel_IsDestListSeparator, PKEY_AppUserModel_RelaunchCommand,
+ PKEY_AppUserModel_RelaunchDisplayNameResource, PKEY_AppUserModel_RelaunchIconResource,
+ PKEY_Title,
+};
+use windows::Win32::System::Com::StructuredStorage::PROPVARIANT;
+use windows::Win32::System::Com::{
+ CoCreateInstance, CoInitializeEx, CoTaskMemAlloc, CoUninitialize, CLSCTX_INPROC_SERVER,
+ COINIT_APARTMENTTHREADED,
+};
+use windows::Win32::System::Variant::VT_LPWSTR;
+use windows::Win32::UI::Shell::Common::{IObjectArray, IObjectCollection};
+use windows::Win32::UI::Shell::PropertiesSystem::{IPropertyStore, SHGetPropertyStoreForWindow};
+use windows::Win32::UI::Shell::{
+ DestinationList, EnumerableObjectCollection, ICustomDestinationList, IShellLinkW,
+ SetCurrentProcessExplicitAppUserModelID, ShellLink,
+};
+
+use crate::apps::{launch_name, APPS, NEW};
+
+/// Skykeep's AppUserModelID: the identifier the installer was built with, so it is the one on
+/// its shortcuts even in a launch run under the old identifier (migrate.rs).
+static APP_ID: OnceLock<String> = OnceLock::new();
+
+/// Said before any window is made: every window, toast and jump list after it is Skykeep's.
+/// The jump lists are written meanwhile, off the startup path.
+pub fn claim(identifier: &str) {
+ let id = APP_ID.get_or_init(|| identifier.to_string());
+ // SAFETY: a plain call with a valid, NUL-terminated string the shell copies.
+ if let Err(e) = unsafe { SetCurrentProcessExplicitAppUserModelID(&HSTRING::from(id.as_str())) }
+ {
+ quiet!("the taskbar was not told Skykeep's app ID: {e}");
+ }
+ std::thread::spawn(|| {
+ // SAFETY: this thread's own apartment, entered and left here; every COM object is
+ // released before CoUninitialize, as each goes out of scope inside write_jump_lists.
+ let entered = unsafe { CoInitializeEx(None, COINIT_APARTMENTTHREADED) }.is_ok();
+ if let Err(e) = write_jump_lists() {
+ quiet!("the jump list could not be written: {e}");
+ }
+ if entered {
+ // SAFETY: as above, once for the CoInitializeEx that succeeded.
+ unsafe { CoUninitialize() };
+ }
+ });
+}
+
+/// The ID a window of app `key` is known by: Skykeep's with the app's name, `<id>.Notes`.
+fn app_id(key: &str) -> Option<String> {
+ let base = APP_ID.get()?;
+ let (_, name) = APPS.iter().find(|(k, _)| *k == key)?;
+ Some(format!("{base}.{name}"))
+}
+
+/// This program, as a jump list or a relaunch command runs it.
+fn exe() -> Option<String> {
+ std::env::current_exe()
+ .ok()
+ .map(|p| p.to_string_lossy().into_owned())
+}
+
+/// Skykeep's jump list — New Note, New Reminder, New Event, then the six apps — and each app's
+/// own: Notes' button offers New Note, Reminders' New Reminder, Calendar's New Event.
+fn write_jump_lists() -> windows::core::Result<()> {
+ let Some(exe) = exe() else {
+ return Ok(());
+ };
+ let Some(main) = APP_ID.get() else {
+ return Ok(());
+ };
+ let mut tasks: Vec<Task> = NEW
+ .iter()
+ .map(|(kind, title, _)| Task::Run(title, format!("--new {kind}")))
+ .collect();
+ tasks.push(Task::Separator);
+ tasks.extend(
+ APPS.iter()
+ .map(|(key, name)| Task::Run(name, format!("--app {}", launch_name(key)))),
+ );
+ write_jump_list(main, &exe, &tasks)?;
+ for (key, _) in APPS {
+ let Some(id) = app_id(key) else { continue };
+ let own: Vec<Task> = NEW
+ .iter()
+ .filter(|(_, _, app)| *app == key)
+ .map(|(kind, title, _)| Task::Run(title, format!("--new {kind}")))
+ .collect();
+ write_jump_list(&id, &exe, &own)?;
+ }
+ Ok(())
+}
+
+/// One line of a jump list's Tasks: a command, or the line between two groups of them.
+enum Task<'a> {
+ Run(&'a str, String),
+ Separator,
+}
+
+/// The Tasks of the jump list of `app_id`, replacing whatever was there.
+fn write_jump_list(app_id: &str, exe: &str, tasks: &[Task]) -> windows::core::Result<()> {
+ // SAFETY: COM calls on objects made here, on a thread in an apartment (claim).
+ unsafe {
+ let list: ICustomDestinationList =
+ CoCreateInstance(&DestinationList, None, CLSCTX_INPROC_SERVER)?;
+ list.SetAppID(&HSTRING::from(app_id))?;
+ let mut slots = 0u32;
+ let _removed: IObjectArray = list.BeginList(&mut slots)?;
+ if !tasks.is_empty() {
+ let collection: IObjectCollection =
+ CoCreateInstance(&EnumerableObjectCollection, None, CLSCTX_INPROC_SERVER)?;
+ for task in tasks {
+ collection.AddObject(&link(exe, task)?)?;
+ }
+ list.AddUserTasks(&collection.cast::<IObjectArray>()?)?;
+ }
+ list.CommitList()
+ }
+}
+
+/// A shell link that runs this program with a task's arguments, under the task's title.
+fn link(exe: &str, task: &Task) -> windows::core::Result<IShellLinkW> {
+ // SAFETY: as in write_jump_list; each string lives across the call that copies it.
+ unsafe {
+ let link: IShellLinkW = CoCreateInstance(&ShellLink, None, CLSCTX_INPROC_SERVER)?;
+ let props: IPropertyStore = link.cast()?;
+ match task {
+ Task::Run(title, args) => {
+ link.SetPath(&HSTRING::from(exe))?;
+ link.SetArguments(&HSTRING::from(args.as_str()))?;
+ link.SetIconLocation(&HSTRING::from(exe), 0)?;
+ props.SetValue(&PKEY_Title, &text(title))?;
+ }
+ Task::Separator => {
+ props.SetValue(
+ &PKEY_AppUserModel_IsDestListSeparator,
+ &PROPVARIANT::from(true),
+ )?;
+ }
+ }
+ props.Commit()?;
+ Ok(link)
+ }
+}
+
+/// An app's window given its own taskbar button: its ID, and how to start it again when it is
+/// pinned (`skykeep --app notes`, named "Skykeep Notes", with Skykeep's icon). Called once the
+/// window exists and before it is first shown; done on the main thread, the window's own.
+pub fn name_window(window: &tauri::WebviewWindow, key: &str) {
+ let (Some(id), Some(exe)) = (app_id(key), exe()) else {
+ return;
+ };
+ let Some((_, name)) = APPS.iter().find(|(k, _)| *k == key) else {
+ return;
+ };
+ let values = vec![
+ (
+ PKEY_AppUserModel_RelaunchCommand,
+ format!("\"{exe}\" --app {}", launch_name(key)),
+ ),
+ (
+ PKEY_AppUserModel_RelaunchDisplayNameResource,
+ format!("Skykeep {name}"),
+ ),
+ (PKEY_AppUserModel_RelaunchIconResource, format!("{exe},0")),
+ // The ID last: with it, the relaunch properties above are read.
+ (PKEY_AppUserModel_ID, id),
+ ];
+ set_on_main(window, values);
+}
+
+/// The window's properties taken off before it is destroyed, as the shell asks of anyone who
+/// set them.
+pub fn unname_window(window: &tauri::WebviewWindow) {
+ set_on_main(
+ window,
+ vec![
+ (PKEY_AppUserModel_ID, String::new()),
+ (PKEY_AppUserModel_RelaunchCommand, String::new()),
+ (PKEY_AppUserModel_RelaunchDisplayNameResource, String::new()),
+ (PKEY_AppUserModel_RelaunchIconResource, String::new()),
+ ],
+ );
+}
+
+/// Each value written to the window's property store on the main thread; an empty one clears
+/// its key.
+fn set_on_main(window: &tauri::WebviewWindow, values: Vec<(PROPERTYKEY, String)>) {
+ let w = window.clone();
+ let done = window.run_on_main_thread(move || {
+ let Ok(hwnd) = w.hwnd() else { return };
+ // SAFETY: a live window of this process, on its own thread; each value lives across
+ // its SetValue, which copies it.
+ let set = unsafe {
+ SHGetPropertyStoreForWindow::<IPropertyStore>(hwnd).and_then(|store| {
+ for (key, value) in &values {
+ let v = if value.is_empty() {
+ PROPVARIANT::default()
+ } else {
+ text(value)
+ };
+ store.SetValue(key, &v)?;
+ }
+ store.Commit()
+ })
+ };
+ if let Err(e) = set {
+ quiet!("a window's taskbar properties were not set: {e}");
+ }
+ });
+ if let Err(e) = done {
+ quiet!("a window's taskbar properties were not set: {e}");
+ }
+}
+
+/// A string as the shell's properties take one: VT_LPWSTR, in memory COM frees (the
+/// PROPVARIANT's own drop clears it).
+fn text(s: &str) -> PROPVARIANT {
+ let wide: Vec<u16> = s.encode_utf16().chain(Some(0)).collect();
+ let mut v = PROPVARIANT::default();
+ // SAFETY: room for every unit and the NUL, copied in whole; the union is written as the
+ // VT_LPWSTR it is then marked as, and PropVariantClear (on drop) frees it with CoTaskMemFree.
+ unsafe {
+ let p = CoTaskMemAlloc(wide.len() * 2).cast::<u16>();
+ if p.is_null() {
+ return v;
+ }
+ std::ptr::copy_nonoverlapping(wide.as_ptr(), p, wide.len());
+ let inner = &mut *v.Anonymous.Anonymous;
+ inner.vt = VT_LPWSTR;
+ inner.Anonymous.pwszVal = PWSTR(p);
+ }
+ v
+}
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index c1ab6dc..40904d8 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -67,7 +67,12 @@
"windows": {
"nsis": {
"installMode": "currentUser",
- "displayLanguageSelector": false
+ "displayLanguageSelector": false,
+ "installerHooks": "../packaging/windows/installer-hooks.nsh"
+ },
+ "wix": {
+ "fragmentPaths": ["../packaging/windows/app-shortcuts.wxs"],
+ "componentRefs": ["SkykeepAppShortcuts"]
},
"webviewInstallMode": {
"type": "downloadBootstrapper",
diff --git a/src/lib/ipc.ts b/src/lib/ipc.ts
index 790e277..379b819 100644
--- a/src/lib/ipc.ts
+++ b/src/lib/ipc.ts
@@ -982,6 +982,9 @@ export const photoCacheApi = {
export const INTAKE = "quince://intake";
/** Told to the quick-capture window when it is asked for again, with the kind now wanted. */
export const CAPTURE = "quince://capture";
+/** Told to Calendar's window to start a new event (`skykeep --new event`, the jump list;
+ * Library.tsx). A window made for it is asked in its address instead: `?new=event`. */
+export const NEW_EVENT = "quince://new-event";
/** An event read from a calendar file: what `eventSave` takes, less the calendar. */
export type ImportEvent = {
diff --git a/src/lib/reveal.ts b/src/lib/reveal.ts
index 4cbf1dc..ef41474 100644
--- a/src/lib/reveal.ts
+++ b/src/lib/reveal.ts
@@ -7,8 +7,9 @@
import { useEffect, useRef } from "react";
/** `within`: where it lives, when the screen needs it to get there — a reminder's list, a
- * file's folder. */
-export type Reveal = { screen: string; id: string; within?: string | null; query?: string; at?: number };
+ * file's folder. `startNew`: not a thing to show but a new one to start there, with no `id` —
+ * Calendar's New Event from the taskbar's jump list. */
+export type Reveal = { screen: string; id: string; within?: string | null; query?: string; at?: number; startNew?: boolean };
const EVENT = "quince:reveal";
const waiting = new Map<string, Reveal>();
diff --git a/src/screens/Library.tsx b/src/screens/Library.tsx
index 8fd5296..c0d1520 100644
--- a/src/screens/Library.tsx
+++ b/src/screens/Library.tsx
@@ -5,7 +5,7 @@ import { lazy, Suspense, useCallback, useEffect, useLayoutEffect, useRef, useSta
import { listen } from "@tauri-apps/api/event";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { PanelLeft } from "lucide-react";
-import { api, messageOf, OPEN_REMINDER } from "../lib/ipc";
+import { api, messageOf, NEW_EVENT, OPEN_REMINDER } from "../lib/ipc";
import { SyncProvider, useSync } from "../lib/sync";
import { AccountCard } from "../components/Account";
import { reveal, type Reveal } from "../lib/reveal";
@@ -169,6 +169,19 @@ void listen<Reveal>(REVEAL, (e) => {
window.dispatchEvent(new CustomEvent("quince:revealed"));
}).catch(() => {});
+/*
+ * "New Event" from the taskbar's jump list (`skykeep --new event`, src-tauri/src/apps.rs):
+ * Calendar brought to the front with a new event started, as its + button does. A Calendar
+ * window made for it is asked in its address; one already open is told.
+ */
+const startNewEvent = () => {
+ revealedScreen = "calendar";
+ reveal({ screen: "calendar", id: "", startNew: true });
+ window.dispatchEvent(new CustomEvent("quince:revealed"));
+};
+if (new URLSearchParams(window.location.search).get("new") === "event") startNewEvent();
+void listen(NEW_EVENT, startNewEvent).catch(() => {});
+
/** The screen open last time, so the app reopens where it was left. */
const LAST_KEY = "quince.library.screen";
const RAIL_KEY = "quince.library.rail";
diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsx
index ab223ef..04bc7de 100644
--- a/src/screens/calendar/CalendarView.tsx
+++ b/src/screens/calendar/CalendarView.tsx
@@ -496,7 +496,13 @@ export function CalendarView() {
// was hidden (and kept shown, as its tick in the list says) — never a found event that
// cannot be seen — and the event itself opened, as Calendar opens one found.
const [finding, setFinding] = useState<string | null>(null);
+ // "New Event" from the taskbar's jump list (`skykeep --new event`, Library.tsx).
+ const [newAsked, setNewAsked] = useState(false);
useReveal("calendar", (r) => {
+ if (r.startNew) {
+ setNewAsked(true);
+ return;
+ }
if (r.at) setSelected(midnight(new Date(r.at * 1000)));
if (view === "year") setView("day");
const cal = r.within;
@@ -1131,6 +1137,13 @@ export function CalendarView() {
setFollowDraft(true);
};
const [followDraft, setFollowDraft] = useState(false);
+ // "New Event" asked from outside the window (useReveal above), held until there is a
+ // calendar to put it in, so a window still loading starts it once it can.
+ useEffect(() => {
+ if (!newAsked || !targetGuid) return;
+ setNewAsked(false);
+ newEvent();
+ });
useLayoutEffect(() => {
if (!followDraft) return;
setFollowDraft(false);