Skip to content

Route all launches through the CLI script (bin/bin/code) - #7

Merged
Link4Electronics merged 15 commits into
pkgforge-dev:mainfrom
Shikakiben:main
Aug 4, 2026
Merged

Route all launches through the CLI script (bin/bin/code)#7
Link4Electronics merged 15 commits into
pkgforge-dev:mainfrom
Shikakiben:main

Conversation

@Shikakiben

@Shikakiben Shikakiben commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

im working on a vscodium anylinux-appimage using this repo as exemple but i find that we can not use the terminal:

If we want to install an extension with the terminal (vscode --install-extension [extension]) it doesn't work because the apprun point to the electron binary (bin/code) so i made a hook for launch all the time the cli script (bin/bin/code) if no cli arguments it launch the binary

it work but i don't know if its the best solution 🤔 i couldn't find a way to make quik-sharun point the apprun directly to bin/bin/code or a way to make it detecting when we use the cli and make it launch the cli script... so... what do you think ?
@Link4Electronics @Samueru-sama

Shikakiben and others added 10 commits August 3, 2026 22:11
Rename the executable to avoid conflicts with quick-sharun and update references in the desktop entry.
Added protection for the CLI script to prevent overwriting.
Add CLI router to ensure commands route through the official launcher.
Updated comments for clarity and improved understanding of script functionality.
@Samueru-sama

Copy link
Copy Markdown
Member

@Shikakiben Lets say I install the VSCode .deb on my machine.

How would I normally launch the bin/bin/code binary in that case?

@Shikakiben

Copy link
Copy Markdown
Contributor Author

@Samueru-sama

AI answer:

With the .deb package, you normally launch the CLI script through the symlink created by postinst:

# postinst
rm -f /usr/bin/codium
ln -s /usr/share/codium/bin/codium /usr/bin/codium

So running codium in a terminal goes through /usr/bin/codium/usr/share/codium/bin/codium (the CLI script). The script then resolves VSCODE_PATH relative to itself and launches the Electron binary with cli.js.

@Samueru-sama

Copy link
Copy Markdown
Member

Wtf

You remove /usr/bin/codium and replace it for /usr/share/codium/bin/codium??????

@Samueru-sama

Copy link
Copy Markdown
Member

Anyways if /usr/bin/codium is the CLI app now, how do I launch the GUI now?

@Shikakiben

Shikakiben commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Wtf

You remove /usr/bin/codium and replace it for /usr/share/codium/bin/codium??????

AI answer:

It's just a symlink — the real script is never touched or moved. Here's what the two lines do:

rm -f /usr/bin/codium — removes any previous symlink left from an older install (cleanup, standard in packaging). It does NOT touch /usr/share/codium/bin/codium.
ln -s /usr/share/codium/bin/codium /usr/bin/codium — creates a new symlink at /usr/bin/codium that points to /usr/share/codium/bin/codium.
Syntax: ln -s . So the file stays where it is; /usr/bin/codium becomes a pointer to it so the shell finds it via $PATH. /usr/share/codium/bin/codium itself is never deleted or modified.

Anyways if /usr/bin/codium is the CLI app now, how do I launch the GUI now?

in my understanding bin/bin/codium is a script and when it doesn't detect cli arguments it run the electron binary

@Shikakiben

Shikakiben commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Anyways if /usr/bin/codium is the CLI app now, how do I launch the GUI now?

ai answer:

The GUI is launched the exact same way — that's the point of the script. The script is a universal entry point, not CLI-only.

It always ends with:

ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"

where $CLI = resources/app/out/cli.js. cli.js dispatches on the arguments:

no args / file paths → spawns the real Electron GUI (normal desktop launch)
--install-extension, --version, etc. → handles the command
So clicking the desktop launcher works identically: our hook routes it through bin/bin/codium → cli.js → GUI. Nothing is lost, no extra step for the user. The script is exactly what the .deb's /usr/bin/codium symlink points to — it's how everyone normally launches both the GUI and the CLI.

One caveat worth noting honestly: in the .deb, the .desktop actually points directly to the ELF (Exec=/usr/share/codium/codium) to skip the script for desktop launches. We route everything through the script for simplicity — it adds a negligible step and guarantees CLI commands always work.

@Samueru-sama

Copy link
Copy Markdown
Member

@Shikakiben I'm investigating, the fact that the script in bin/bin/code was replaced with a sharun hardlink is a bug on its own. Will fix that first.

@Shikakiben

Copy link
Copy Markdown
Contributor Author

@Samueru-sama oki thanks 🙂

Samueru-sama added a commit to pkgforge-dev/Anylinux-AppImages that referenced this pull request Aug 4, 2026
@Samueru-sama

Copy link
Copy Markdown
Member

@Shikakiben the bug has been fixed.

We still have the problem that the appimage will launch the code binary instead of the code script.

Since the code script eventually goes and executes the code binary anyway, a better fix would be to implement the script logic as a hook here.

TLDR: Rebase your PR and tell your AI to implement the code script as a hook, I can help finish it up since the original code script has a few issues that can be improved.

Implement CLI script as a hook for VS Code launches, handling remote CLI and WSL prompts.
@Shikakiben

Shikakiben commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

@Samueru-sama i changed it
but are you sur its the right call? because in this case we don't use the official script and if someday it change we will not know...for what it does i don't think its a problem but i don't know?

@Samueru-sama

Copy link
Copy Markdown
Member

are you sur its the right call?

Yes, because:

  • The official script is ass.
  • We have no other solution, we can try to rename the code binary but that is likely to run into issues in the future
  • We still need to edit the script to use the APPDIR vars.

If anything, the script will likely disappear in the future instead of changing.

Now I will do some edits to improve the script.

@Samueru-sama

Copy link
Copy Markdown
Member

@Shikakiben let me know if everything is in working order now, including the GUI launching normally.

@Shikakiben

Copy link
Copy Markdown
Contributor Author

hoho! you can directly modify in my repo 😯😎 ! its building i let you know!👍

@Shikakiben

Copy link
Copy Markdown
Contributor Author

@Samueru-sama yes everything is working 👍🙂, at least for this problem (CLI, GUI) for the rest i am not a "Hard" user so i can not tel 😅

@Link4Electronics
Link4Electronics merged commit 2b1e802 into pkgforge-dev:main Aug 4, 2026
1 check passed
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.

3 participants