Skip to content

Instantly share code, notes, and snippets.

@socheatsok78
Last active August 31, 2018 17:01
Show Gist options
  • Save socheatsok78/9623e8f6da0acbec10d4ae1171bb7c70 to your computer and use it in GitHub Desktop.
Save socheatsok78/9623e8f6da0acbec10d4ae1171bb7c70 to your computer and use it in GitHub Desktop.
Add URL Handler to Visual Studio Code on Linux, vscode, code, linux

How to Install

  • Create vscode-url-handler in /usr/bin
  • Create vscode-url-handler.desktop in /usr/share/applications
  • Edit mimeappd.list in /usr/share/applications/mimeappd.list

Understand? Good!

x-scheme-handler/vscode=code-url-handler.desktop
#!/usr/bin/env bash
# Launch Visual Studio Code
/usr/share/code/code -g -r "$(echo ${1:14} | echo -e "$(sed 's/+/ /g; s/%/\\x/g')")"
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Visual Studio Code URL Handler
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/bin/vscode-url-handler %u
Icon=code
Type=Application
StartupNotify=false
StartupWMClass=Code
NoDisplay=true
Terminal=false
Categories=Utility;TextEditor;Development;IDE;
MimeType=x-scheme-handler/vscode
Keywords=vscode-handler;
X-Desktop-File-Install-Version=0.22
Name[en_US]=code-url-handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment