Markpad icon indicating copy to clipboard operation
Markpad copied to clipboard

Add a "-launch--options", or, if they exist, sorry i didn't found guide for use them..

Open r0l1ka opened this issue 6 months ago • 1 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I couldn't find a guide for launch options, in my case, I want to have a portable USB with .md guide, and have a .ink shortcut to open README with my settings.

Describe the solution you'd like A clear and concise description of what you want to happen. Add, or if launch options already exist, refer to wiki, maybe?

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

r0l1ka avatar May 18 '26 21:05 r0l1ka

For a USB stick, use the portable build (Markpad_x.y.z_x64.exe, or _arm64.exe) from the releases page. It needs no install.

There's no separate launch-options feature, but you don't need one to open a file. Markpad treats every argument as a file path:

Markpad.exe README.md

Relative paths resolve against the working directory, so in a .lnk set "Start in" to the folder that holds README.md. On a USB stick the drive letter changes between machines, which breaks a .lnk's absolute target, so a .cmd file next to the exe is more reliable:

start "" "%~dp0Markpad.exe" "%~dp0README.md"

Settings don't travel with the exe yet, even with the portable build. They're stored per user in %APPDATA%, so on another machine Markpad starts with defaults.

Notes for maintainers: what a portable mode would take

Markpad writes to the host in two places today, and both would have to move:

  1. Rust side: app.path().app_config_dir() (%APPDATA%\com.alecdotdev.markpad). Nine call sites: app.rs:176, commands.rs:505/636/657/676/688/705, window_runtime.rs:91.
  2. WebView2 user data (localStorage, cache), default %LOCALAPPDATA%\com.alecdotdev.markpad\EBWebView. Nothing sets data_directory, so it stays on the host even if (1) moves.

A minimal version, following how other portable apps do it:

  • Trigger on a marker next to the exe (std::env::current_exe()), not a flag, since a double-click passes no arguments.
  • Route every app_config_dir() call through one helper that returns <exe dir>\data when the marker exists.
  • Call .data_directory(<exe dir>\data\webview) on both WebviewWindowBuilders (app.rs:73, window_runtime.rs:637). WebView2 expects all webviews in one process to share a user data folder, so missing one breaks the transfer window.

How other apps trigger it:

  • VS Code: a data folder next to Code.exe. User data and extensions go under it.
  • Notepad++: a doLocalConf.xml next to the exe. Config is kept in the exe's folder.
  • KeePass 2 (ZIP package): settings in KeePass.config.xml in the app folder.
  • Chrome/Electron: --user-data-dir=<path> / app.setPath('userData'), set by a launcher.
  • PortableApps.com: a wrapper copies settings into %APPDATA% before launch and back after exit. The app itself is unaware.

PathGao avatar Sep 29 '26 23:09 PathGao