8000 Open .ink file passed on the command line on Linux by Sal3k · Pull Request #561 · inkle/inky · GitHub
[go: up one dir, main page]

Skip to content

Open .ink file passed on the command line on Linux - #561

Open
Sal3k wants to merge 2 commits into
inkle:masterfrom
Sal3k:fix-linux-open-file
Open

Sal3k wants to merge 2 commits into
inkle:masterfrom
Sal3k:fix-linux-open-file

Conversation

@Sal3k
@Sal3k Sal3k commented Oct 19, 2026
Copy link
Copy Markdown

Fixes the Linux part of #80.

Problem
On Linux, opening an .ink file via double-click (file association / .desktop %f) or inky /path/story.ink always opens a new untitled story. The command-line argument was only handled when process.platform == "win32".

Changes (app/main-process/main.js)

  • Handle the command-line .ink argument on all platforms except macOS (which uses the open-file event).
  • Use the matched argument instead of always process.argv[1] (also affected Windows when the file was not the first argument).
  • Resolve relative paths with path.resolve.

Tested on CachyOS (Arch-based), KDE Plasma 6:

  • npm start -- /absolute/path/story.ink and a relative path: file opens.
  • Double-click / "Open with" from Dolphin via a .desktop entry with %f: file opens.
  • Launching without arguments: empty project as before.

Found and fixed with help from Claude.

🤖 Generated with Claude Code

The command-line file argument was only handled on Windows, so on Linux double-clicking an .ink file (or running 'inky story.ink') always opened an untitled story. Also use the matched argument instead of always argv[1], and resolve relative paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lunarcloud
Copy link
Copy Markdown
Contributor

Interesting, but you also need me to add the %f argument to resources/com.inkle.inky.desktop

@Sal3k
Sal3k commented Oct 19, 2026
Copy link
Copy Markdown
Author

Interesting, but you also need me to add the %f argument to resources/com.inkle.inky.desktop

Good catch, you're right. I've tested it on my own .desktop which already had the %f.
I think it should be fixed now. :)

@Sal3k
Sal3k force-pushed the fix-linux-open-file branch from 0a58fc2 to 7589e40 Compare November 1, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0