-
Notifications
You must be signed in to change notification settings - Fork 0
/
user-install-vscode
executable file
·53 lines (45 loc) · 1.69 KB
/
user-install-vscode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env sh
set -eu
install_vscode() {
echo "Installing Visual Studio Code..."
mkdir -p $HOME/.local/bin
mkdir -p $HOME/.local/share/VSCode
mkdir -p $HOME/.local/share/applications
curl -fsSL "https://code.visualstudio.com/sha/download?build=stable&os=linux-x64" | tar --strip-components=1 --directory=$HOME/.local/share/VSCode -xz
ln -fs $HOME/.local/share/VSCode/bin/code $HOME/.local/bin
cat >$HOME/.local/share/applications/code-url-handler.desktop <<-EOF
[Desktop Entry]
Name=Visual Studio Code - URL Handler
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=$HOME/.local/share/VSCode/code --no-sandbox --open-url %U
Icon=$HOME/.local/share/VSCode/resources/app/resources/linux/code.png
Type=Application
NoDisplay=true
StartupNotify=true
Categories=Utility;TextEditor;Development;IDE;
MimeType=x-scheme-handler/vscode;
Keywords=vscode;
EOF
cat >$HOME/.local/share/applications/code.desktop <<-EOF
[Desktop Entry]
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=$HOME/.local/share/VSCode/code --no-sandbox --unity-launch %F
Icon=$HOME/.local/share/VSCode/resources/app/resources/linux/code.png
Type=Application
StartupNotify=false
StartupWMClass=Code
Categories=Utility;TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-code-workspace;
Actions=new-empty-window;
Keywords=vscode;
[Desktop Action new-empty-window]
Name=New Empty Window
Exec=$HOME/.local/share/VSCode/code --no-sandbox --new-window %F
Icon=com.visualstudio.code
EOF
chmod 744 $HOME/.local/share/applications/code.desktop $HOME/.local/share/applications/code-url-handler.desktop
}
install_vscode "$@"