Store: Open With (files the OS hands over) and the icons and builtin catalog kinds

Open With: store_commands keeps each existing file the OS hands over (launch
argument, a second launch forwarded by single-instance with its working
directory, a macOS file:// open-URL) under a random id (Store::receive_file:
name says what it is, regular file, size cap, 8 kept, 15 minutes) and queues
LinkEvent.opened {id, name, kind}. The shell-only install_stage_opened {id}
reads that one file once and stages it exactly like a dropped file; it takes
an id only (testkit asserts that), so the shell cannot name a path. The shell
shows the same install screen; nothing installs without it. The NSIS template
lists the app under "Open with" for the declared extensions (OpenWithProgids)
and never makes it the default program, unlike Tauri's own macro.

Catalog kinds: icons (an icon pack, *.icons.json, at most 120 KB; validate_icons,
staged and committed as text for the shell, the install screen draws every icon,
.icons.json is no longer read as a theme) and builtin (a feature the app
already has, such as an area plugin: no url, sha256, size or file; never staged;
the Store view lists it as Built in with the app's own switch via the areas
prop). Rust: Kind, CatalogItem.check, verify_item, install links refuse builtin.
JS: storeModel, installController (requestOpened, icons adapter), InstallDialog,
StoreView, StoreSection (remove an icon pack, area switches), words. CLI and
JSON Schema: kinds, optional url/sha256/size on builtin, icons size cap; the
test schema validator learns not and if/then/else. docs/STORE.md.
This commit is contained in:
CRTkafa 2026-10-01 14:23:23 +07:00
parent e85a00eca3
commit 5aa66e7191
21 changed files with 1015 additions and 90 deletions

View file

@ -58,6 +58,26 @@ ManifestDPIAwareness PerMonitorV2
${StrCase}
${StrLoc}
; wayBetter: file associations that never take a file type over. Tauri's APP_ASSOCIATE makes the
; app the default program for the extension, which for `.js` and `.json` (a wayBetter plugin is
; `name.plugin.js`, a theme `name.json`; Windows only knows the last part) would claim every
; script and JSON file on the machine. These two only list the app under "Open with" for the
; extension (OpenWithProgids) and register what that entry runs; the owner's default stays as it
; is. The app then shows its own install screen for the file (nothing installs without it).
!macro WaybetterOpenWith EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
WriteRegStr SHCTX "Software\Classes\.${EXT}\OpenWithProgids" "${FILECLASS}" ""
WriteRegStr SHCTX "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}`
WriteRegStr SHCTX "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}`
WriteRegStr SHCTX "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
WriteRegStr SHCTX "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}`
System::Call 'Shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)'
!macroend
!macro WaybetterNoOpenWith EXT FILECLASS
DeleteRegValue SHCTX "Software\Classes\.${EXT}\OpenWithProgids" "${FILECLASS}"
DeleteRegKey SHCTX "Software\Classes\${FILECLASS}"
System::Call 'Shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)'
!macroend
{{#if installer_hooks}}
!include "{{installer_hooks}}"
{{/if}}
@ -556,7 +576,7 @@ Section Install
; Create file associations
{{#each file_associations as |association| ~}}
{{#each association.ext as |ext| ~}}
!insertmacro APP_ASSOCIATE "{{ext}}" "{{or association.name ext}}" "{{association-description association.description ext}}" "$INSTDIR\${MAINBINARYNAME}.exe,0" "Open with ${PRODUCTNAME}" "$INSTDIR\${MAINBINARYNAME}.exe $\"%1$\""
!insertmacro WaybetterOpenWith "{{ext}}" "{{or association.name ext}}" "{{association-description association.description ext}}" "$INSTDIR\${MAINBINARYNAME}.exe,0" "Open with ${PRODUCTNAME}" "$INSTDIR\${MAINBINARYNAME}.exe $\"%1$\""
{{/each}}
{{/each}}
@ -699,7 +719,7 @@ Section Uninstall
; Delete app associations
{{#each file_associations as |association| ~}}
{{#each association.ext as |ext| ~}}
!insertmacro APP_UNASSOCIATE "{{ext}}" "{{or association.name ext}}"
!insertmacro WaybetterNoOpenWith "{{ext}}" "{{or association.name ext}}"
{{/each}}
{{/each}}