Create a launcher file for the script. A launcher file is a text file with specific format and .desktop
extension, as outlined elsewhere on Askubuntu.
The line that defines the command that must be run is the line starting with Exec=
. The parser for that line is rather primitive: you only can provide it with a single command and arguments. There are a couple of ways around that:
1) Create a wrapper script containing the commands and call the wrapper script on the Exec=
line
2) Launch bash
with the -c
argument.
For approach 2), more practical for just a few commands, your specific Exec=
line would appear as:
Exec=sh -c "cd /home/bmshamsnahid/Android/Sdk/emulator && ./emulator -avd Pixel_2_XL_API_29"
Create the .desktop
file in .local/share/applications
if it is only for you (no root permissions needed), or in /usr/share/applications
if the launcher must be available for all users. Correctly formatted .desktop
files in any of these directories will automatically appear in your application menu, from where you can optionally pin it to the Dock.