Opening a file
The ways to open a Markdown file in Sashmark, and what the messages mean when a file will not open.
Sashmark opens Markdown files: names ending in .md or .markdown (upper or lower case).
On macOS, other file watches can use a completed startup check's result while that check finishes stopping. Starting the check itself can still take time.
Ways to open a file
- Open button. When no file is open, the window shows an Open a file button. Click it, or press Enter while it has focus.
- Shortcut. Press Cmd+O on Mac or Ctrl+O on Windows and Linux. You can pick several files at once.
- Open menu (Mac and Linux). Choose File > Open…. Windows has no File menu; use Ctrl+O or the Open button.
- Drag and drop. Drag one or more Markdown files onto the window.
- Terminal. Type
sashmark notes.md(Mac, Windows and Linux). See The sashmark command. - Double-click (Mac). If Sashmark is the app for Markdown files, double-click a file in Finder.
- Open with (Linux). The Linux desktop entry declares Markdown support, so your file manager can offer Sashmark for Markdown files. You can choose it as the default app in your file manager.
Sashmark can have several windows (see Multiple windows). A file opened from inside Sashmark (Open, Recent, a drop, a link) opens as a new tab in the window you are using; from a New Tab, it takes the New Tab's place. A file from outside (terminal, file association, Finder or Explorer) opens in the window you used last, and a bare sashmark brings that window forward. A file is open in only one window: opening it again goes to the window that already has it.
After you open a file with the Open button, Recent list, File menu, drag and drop, or a link in a page, the page receives focus when it is ready unless you switch tabs or move focus somewhere else outside an open panel while it loads. You can then type or use reading keys without clicking the page first. Files register and load immediately even while a panel is open. Using or closing that panel does not cancel the open; page focus waits until the panel closes.
For a terminal, agent, second app instance, or file association, Sashmark decides at load completion. A file you picked inside Sashmark keeps priority over a later outside delivery while it loads. Among several outside files, only the newest one may take the page; if it fails, an older file stays open in a background tab. An eligible outside file receives page focus when the window is unfocused or when focus is still on a control Sashmark chose by default, such as the startup Open button or a restored tab. A field, editor, tab or close button that you reached by clicking or using the keyboard keeps exact focus. Background opens never move page focus.
On Mac, Sashmark reads the request macOS sends with the file. A Finder double-click, Open With, or a plain open command is your open: it is handled like a file from the terminal, so the window that already has the file comes to the front and shows its tab, unless that window is still opening a file you chose inside it. A script's open -g -a Sashmark /absolute/path/to/doe-notes.md is a background open: no window is raised, no tab changes and focus does not move. If Sashmark cannot read the request, it treats it as your open. macOS controls whether the app itself activates; Sashmark does not add a request to raise, unhide or restore the app for these file events. Starting Sashmark may still bring its window forward; background startup is not guaranteed.
On all three systems, opening files from the terminal brings the target window forward by default (the window that already has the file, or else the last-used window), including when a file cannot be opened. With open_files_in_background on, file requests forwarded to an already-running Sashmark do not ask to raise or focus its window; errors still appear there. Running sashmark without a file still brings the window forward. Cold launch still shows and focuses the window.
If a file is already open, opening it again from inside Sashmark switches to its tab. To recover a tab you closed, use Shift+Cmd+T on Mac or Ctrl+Shift+T on Windows and Linux, File > Reopen Closed Tab on Mac and Linux, or the command palette on any system. See Tabs.
Open files in the background
This setting is off by default. In settings.json in the app data folder, set "open_files_in_background": true. If the key is missing, add it to the existing JSON object, keeping its other keys and valid comma separators. Save the file; the next request forwarded by the sashmark command reads the new value without restarting Sashmark. Set it to false to restore the default.
The setting skips Sashmark's foreground request and its page-focus handoff when a running instance receives one or more file paths. Files still appear as tabs, while a field you are using keeps focus; a missing or unreadable file still produces its notice. Finder and macOS open remain OS-controlled, and cold launch is unchanged. Desktop focus checks are still pending.
When a file does not open
The automatic open log, which holds no file names or paths, is ~/Library/Logs/com.sashmark.app/open-requests.log on Mac, %LOCALAPPDATA%\com.sashmark.app\logs\open-requests.log on Windows, and $XDG_DATA_HOME/com.sashmark.app/logs/open-requests.log (normally ~/.local/share/com.sashmark.app/logs/open-requests.log) on Linux.
Messages show in a bar at the top of the window, under the tabs. The bar floats over the page, so the text never moves when a message shows or goes. A bar that waits for your choice has a Hide button: it hides the bar and puts a button at the right end of the tab row to open it again.
| Message | What it means |
|---|---|
File not found: <path> |
Nothing exists at that path. Check the spelling, or the folder you ran the command from. |
Not a Markdown file: <path> |
The file name does not end in .md or .markdown. |
Could not open <path>: <reason> |
The file exists but could not be read, for example because you do not have permission, or because it is not a regular file (for example a named pipe). |
Waiting for <name> to download from the cloud… |
The file is in a synced folder (iCloud Drive, OneDrive) and only its placeholder is on this computer, or getting its full content from the cloud failed. Sashmark reads the whole file before it shows it, and tries 4 times in all, waiting 2, 4 and 8 seconds between tries. |
Could not open <path>: it is still in the cloud and didn't download. Check the connection, then open it again. |
All 4 tries failed. Nothing was changed. If the tab was already open, it keeps its text. |
This file is not valid UTF-8. Some characters may show as �. |
The file opened, but some bytes are not readable text. Sashmark shows them as � and never changes the file. |
Example
Jane Doe keeps her notes in ~/Documents/doe-notes/. She runs:
cd ~/Documents/doe-notes
sashmark plan.md ideas.md
Both files open as tabs in the window she used last.