ubuntuvisual-studio-codexdgutilscodeium

How can i open a vscode:// link directly to vscode instead of following the "open xdg-open" prompt?


I am trying to login to codeium from inside vscode (using the corresponding codeium extension), but during this process the site needs to open back a vscode:// url.

For some reason after confirming the "Open with xdg-open?" dialog, I get a window "No apps available".

Fortunately I can copy the link.

What I do not know is where I should paste that link in vscode in order to complete the process.


Solution

  • Vscode (or vscodium) can open that link with command like

    /path/to/vscode --open-url [the url]
    

    (Run that on terminal)


    You can also register application to open that link automatically, by making .desktop file

    example file in /usr/share/applications/code-url-handler.desktop

    [Desktop Entry]
    Name=Visual Studio Code - URL Handler
    Comment=Code Editing. Redefined.
    GenericName=Text Editor
    Exec=/usr/share/code/code --open-url %U
    Icon=vscode
    Type=Application
    NoDisplay=true
    StartupNotify=true
    Categories=Utility;TextEditor;Development;IDE;
    MimeType=x-scheme-handler/vscode;
    Keywords=vscode;
    

    Then run command

    xdg-mime default code-url-handler.desktop x-scheme-handler/vscode
    

    After that, whenever your web-browser tried to open that link, the browser will execute command like xdg-open vscode://some.url/, that will open your vscode with --open-url parameter that i mentioned above