DEV Community

sium_hossain
sium_hossain

Posted on

Creating a desktop shortcut for a shell script (Ex:How to add Android Studio to the launcher)

You can set desktop icon in your machine of any kind of .sh executable file. Here we can use android studio studio.sh file to set it as desktop app icon.
When you download android studio from Android studio official site and after extract you will get studio.sh executable file. And you can run android studio from terminal by

./studio.sh
Enter fullscreen mode Exit fullscreen mode

Install android studio

But who used terminal to run a application, let's set a desktop icon

Create a studio.desktop file in desktop location or you can set name as your wish like - name.desktop

[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Exec= sh /path/to/studio.sh #path to your studio.sh file mine is /usr/local/android-studio/bin/studio.sh
Icon=/usr/local/android-studio/bin/studio.png #path to your application icon 
Categories=Development;IDE;
Terminal=false
StartupNotify=true
StartupWMClass=jetbrains-android-studio
Name[en_GB]=android-studio.desktop
Enter fullscreen mode Exit fullscreen mode

Paste that piece of code into studio.desktop file

Save it...

Then go to your desktop, and you will see the icon of your application. But you will see an error something like launch your application. So you have to give permission to launch that application. Right-click your mouse on that icon, and you will get an option

Voila... now we can run our script as a desktop icon 😎

Latest comments (0)