1

I have a BeagleBone Black here, running Debian 8.3, Linux 4.1.15-ti-rt-r43. Desktop is LXQT.

After boot, I want to run a .sh file - when the desktop environment is ready, as that file, after changing path and setting some variables, calls mono to start a GUI based program.

Using the "start menu":

Preferences -> LXQt settings -> Sessions settings -> Autostart

I added an entry, first under "Global Autostart", later under "LXQt Autostart" (only one of both boxes checked at a time). I specified, under "command", the path to my .sh script, via the "Search..." button, i.e. no mistyping possible. I tried it with both, "Wait for system tray" checked, and unchecked. Hit "close", and rebooted the machine via start menu each try.

After the desktop starts, nothing else happens. The script does run fine from ssh remote* command prompt, though - the app starts. Also, copying it to the Desktop and clicking it - works.

_* the .sh file contains the line "export DISPLAY=:0" as it was first used to start via ssh to start a GUI app. I commented it out to see if that changes anything here, it doesn't.

EDIT: So I have now manually crafted a .desktop file in ~/.config/autostart - noting the .desktop files LXQt made in that folder by me clicking around in the UI as described above. In my file, I specified the paths etc to start my .sh script, and set one extra option to true: "Terminal", which specifies the autostart program should be run in a terminal. What this did was to show me - yes indeed, something gets started after boot / loading desktop env, because the terminal is visible, i.e. my autostart file is not ignored. But the "echo" commands in my .sh script do not show up on that terminal, nor is my mono application started. If I then open another remote shell, and copy+paste the path I gave in the autostart .desktop file under "Exec", it does start my app as supposed - so the path is correct.

So, what's happening there? The LXQt desktop obviously finds my file, tries to autostart, but it doesn't do anything. Possible causes? I thought (not really knowing how this all works under the hood), perhaps mono/GUI isn't ready yet, even though the desktop loaded, for some funny reason, and I put a echo "sleeping...", sleep 30s, echo "calling mono app..." before calling the mono app in my .sh file that's supposed to autostart. None of this is visible inthe temrinal that does now open upon start, and it doesn't help.

  • Btw., feel free to add comments about alternate ways of achieving my goal, which don't answer "the question". I thought, if the desktop needs to be running to start my GUI program, using the desktop system's autostart facilities would be a no-brainer choice. Oh well. – sktpin Jun 11 '18 at 15:21
0

Okay, it works. I don't have a very precise answer to the exact question of why the autostart did not work other than noting the difference of: .sh file does not work, application directly does work.

What I did now:

After deleting the old .desktop files in autostart folder, I created the one:

$ nano ~/.config/autostart/MyAppName.desktop

Inserted this:

[Desktop Entry]
Exec=mono /full/path/to/mono_c#/gui/app/myappname.exe
Path=/full/path/to/working/directory
Name=MyAppName
Type=Application
Version=1.0

Note: the executable here for "Exec", found via the path variable, is mono, and its command line arg is the path to the "executable" which runs on the mono framework.

This works as supposed. Reboot -> app starts.

Edit: Note that for me, the app did not have the working directory assigned by Path, probably an error on my side somewhere, but I'll mention it, just in case.

Now I would have liked some things to be done in the original .sh file that refuses to work here. So I won't "accept" my own answer for a while, in case somebody comes along who can tell precisely what's going on.

Edit - some refs:

https://wiki.archlinux.org/index.php/Desktop_entries#File_example

https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.