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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,23 @@ once_cell = "1"

[target.'cfg(windows)'.dependencies]
windows = { version = "0.62", features = [
"ApplicationModel",
"Foundation",
"Win32_Foundation",
"Win32_System_Com",
"Win32_System_Console",
"Win32_System_LibraryLoader",
"Win32_System_Ole",
"Win32_System_Registry",
"Win32_Storage_Packaging_Appx",
"Win32_UI_WindowsAndMessaging",
"Win32_UI_Input_KeyboardAndMouse",
"Win32_Graphics_Dwm",
"Win32_Graphics_Gdi",
"Win32_UI_Shell",
"Win32_Media_Audio",
] }
windows-future = "0.3"
windows-sys = { version = "0.59", features = [
"Win32_Foundation",
"Win32_Security",
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ System → About. Everything else is x64.
`openwritr-windows-<arch>-vX.Y.Z-setup.exe` from
[Releases](https://github.com/trsdn/openwritr-windows/releases/latest)
and run it. Sets up the Start Menu shortcut, an optional autostart-at-logon
entry, and a proper uninstaller you'll find under Settings → Apps.
entry, and a proper uninstaller you'll find under Settings → Apps. You can
turn autostart on or off any time later under Settings → Startup.

**Portable zip.** Download `openwritr-windows-<arch>-vX.Y.Z.zip` and unzip
it into **any folder you like** (e.g. `C:\Tools\OpenWritr\`), then run
`openwritr.exe`. The app finds its DLLs next to the exe — the install
location doesn't matter. Same binaries as the installer, just no shortcuts
and no autostart.
location doesn't matter. Same binaries as the installer, just no shortcuts.
Autostart is available here too: enable "Run at startup" under Settings →
Startup, and OpenWritr repairs the entry automatically if you later move the
folder.

> **Note:** user data (settings, downloaded models, logs) always lives under
> `%LOCALAPPDATA%\OpenWritr\` — the app creates that folder automatically on
Expand Down
40 changes: 39 additions & 1 deletion installer/openwritr-x64.iss
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,52 @@ Source: "{#SrcDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs cre
Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: startmenuicon
Name: "{group}\Uninstall {#AppName}"; Filename: "{uninstallexe}"; Tasks: startmenuicon
Name: "{userdesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon
Name: "{userstartup}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: autostart

[Registry]
; Autostart is a HKCU\...\Run value so the app can read, toggle, and verify the
; exact same mechanism at runtime (Settings → Startup). uninsdeletevalue removes
; it on uninstall even if the task was unselected but later enabled in the app.
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "OpenWritr"; ValueData: """{app}\{#AppExeName}"""; Flags: uninsdeletevalue; Tasks: autostart

[InstallDelete]
; Migrate away from the legacy startup-folder shortcut used by older installers,
; so autostart state never lives in two mechanisms at once. Gated on the autostart
; task so we only remove the shortcut when we actually write the Run value in its
; place. If the user deselects autostart on upgrade, the shortcut is left untouched
; and the app-side migration in autostart.rs remains able to pick it up later —
; a previously active autostart is never silently dropped.
Type: files; Name: "{userstartup}\{#AppName}.lnk"; Tasks: autostart

[Run]
Filename: "{app}\{#AppExeName}"; Description: "Launch {#AppName}"; Flags: nowait postinstall skipifsilent

[UninstallRun]
Filename: "{cmd}"; Parameters: "/C taskkill /IM {#AppExeName} /F"; Flags: runhidden; RunOnceId: "KillOpenWritr"
; Always remove the autostart Run value, even if the user enabled it from inside
; the app after installing without the autostart task (so uninsdeletevalue never
; recorded it). reg delete is a no-op with exit 1 if it is already gone.
Filename: "{cmd}"; Parameters: "/C reg delete ""HKCU\Software\Microsoft\Windows\CurrentVersion\Run"" /v OpenWritr /f"; Flags: runhidden; RunOnceId: "RemoveOpenWritrRun"

[UninstallDelete]
; Leave user data (settings, models, logs) under %LOCALAPPDATA%\OpenWritr\ alone.
Type: files; Name: "{userstartup}\{#AppName}.lnk"
Type: filesandordirs; Name: "{app}"

[Code]
// Preselect the autostart task on upgrade when this user already had autostart
// enabled by an older install — either the legacy startup-folder shortcut or the
// HKCU Run value. Inno remembers the previous task selection across upgrades, so
// a user who once deselected the task would otherwise get it deselected again by
// default; this restores it to checked when prior autostart state is detected.
function LegacyAutostartEnabled(): Boolean;
begin
Result := FileExists(ExpandConstant('{userstartup}\{#AppName}.lnk')) or
RegValueExists(HKEY_CURRENT_USER,
'Software\Microsoft\Windows\CurrentVersion\Run', 'OpenWritr');
end;

procedure InitializeWizard();
begin
if LegacyAutostartEnabled() then
WizardSelectTasks('autostart');
end;
43 changes: 42 additions & 1 deletion installer/openwritr.iss
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,24 @@ Source: "{#SrcDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs cre
Name: "{group}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: startmenuicon
Name: "{group}\Uninstall {#AppName}"; Filename: "{uninstallexe}"; Tasks: startmenuicon
Name: "{userdesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon
Name: "{userstartup}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: autostart

[Registry]
; Autostart is a HKCU\...\Run value so the app can read, toggle, and verify the
; exact same mechanism at runtime (Settings → Startup). uninsdeletevalue removes
; it on uninstall even if the task was unselected but later enabled in the app.
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; \
ValueType: string; ValueName: "OpenWritr"; \
ValueData: """{app}\{#AppExeName}"""; \
Flags: uninsdeletevalue; Tasks: autostart

[InstallDelete]
; Migrate away from the legacy startup-folder shortcut used by older installers,
; so autostart state never lives in two mechanisms at once. Gated on the autostart
; task so we only remove the shortcut when we actually write the Run value in its
; place. If the user deselects autostart on upgrade, the shortcut is left untouched
; and the app-side migration in autostart.rs remains able to pick it up later —
; a previously active autostart is never silently dropped.
Type: files; Name: "{userstartup}\{#AppName}.lnk"; Tasks: autostart

[Run]
; Optional: launch right after install. SkipIfSilent so headless installs don't pop a window.
Expand All @@ -81,8 +98,32 @@ Filename: "{app}\{#AppExeName}"; Description: "Launch {#AppName}"; Flags: nowait
[UninstallRun]
; Stop any running instance before removing files.
Filename: "{cmd}"; Parameters: "/C taskkill /IM {#AppExeName} /F"; Flags: runhidden; RunOnceId: "KillOpenWritr"
; Always remove the autostart Run value, even if the user enabled it from inside
; the app after installing without the autostart task (so uninsdeletevalue never
; recorded it). reg delete is a no-op with exit 1 if it is already gone.
Filename: "{cmd}"; Parameters: "/C reg delete ""HKCU\Software\Microsoft\Windows\CurrentVersion\Run"" /v OpenWritr /f"; Flags: runhidden; RunOnceId: "RemoveOpenWritrRun"

[UninstallDelete]
; Leave user data (settings, models, logs) under %LOCALAPPDATA%\OpenWritr\ alone.
; Only the app/ subfolder is uninstalled. Add a custom message in the wizard.
Type: files; Name: "{userstartup}\{#AppName}.lnk"
Type: filesandordirs; Name: "{app}"

[Code]
// Preselect the autostart task on upgrade when this user already had autostart
// enabled by an older install — either the legacy startup-folder shortcut or the
// HKCU Run value. Inno remembers the previous task selection across upgrades, so
// a user who once deselected the task would otherwise get it deselected again by
// default; this restores it to checked when prior autostart state is detected.
function LegacyAutostartEnabled(): Boolean;
begin
Result := FileExists(ExpandConstant('{userstartup}\{#AppName}.lnk')) or
RegValueExists(HKEY_CURRENT_USER,
'Software\Microsoft\Windows\CurrentVersion\Run', 'OpenWritr');
end;

procedure InitializeWizard();
begin
if LegacyAutostartEnabled() then
WizardSelectTasks('autostart');
end;
Loading
Loading