0

I want to have a desktop shortcut for TWO apps in .sh format with a 15 seconds' delay between them during the launch. Is it possible? What kind of script I have to do for that? If anyone can give me an exemple please? (Ubuntu desktop 22.04)

Thx guys!

3
  • 1
    there is a BASH/shell command sleep that allows you to specify how many seconds to delay; why not use it between the execution of apps?
    – guiverc
    Dec 17, 2022 at 12:14
  • Normally I launch the two apps with cli. But it's for launch rapidly with double click for users who doesn't know bash command..
    – Pinedours
    Dec 17, 2022 at 13:19
  • I don't know what I have to write in the script, I never did that. Usually I copy paste existent scripts I find on internet, but I didnt find this. '😅
    – Pinedours
    Dec 17, 2022 at 13:20

1 Answer 1

0

For sure it is possible! In any .sh script, you can combine as many commands as you wish! Then use the sleep command to include a delay.

1. Create a launcher script: Thus, if you have two apps, myapp1.sh and myapp2.sh, make a third app for example myapplauncher.sh, with the contents

#!/bin/bash
myapp1.sh &
sleep 15
myapp2.sh

This launches the first app and forks it to the background (by adding the &). Thus, the script immediately proceeds with a sleep 15 command, introducing the 15 second pause. Then the second app is launched.

2. Create a .desktop launcher: The next step is to make a .desktop shortcut for myapplauncher.sh.

The easiest way may be to install a tool "Alacarte" or "MenuLibre". This provides a graphical interface to create desktop launchers.

Alternatively, create a .desktop launcher yourself. It should contain at minimum:

[Desktop Entry]
Name=Editor
Exec=gedit
Type=Application

You can add a comment (Comment=...), specify an icon (Icon=...), and more. You can see many examples of .desktop files under /usr/share/applications.

When finished creating the .desktop launcher, copy it into ~/.local/share/applications if it has to appear in the menu of your user only, or into /usr/local/share/applications if the launcher should be available for all users. To achieve the latter, you need root permissions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .