creating/running myapp.desktop

The standard panel of LXDE - http://wiki.lxde.org/en/LXPanel
Locked
davekimble
Posts: 13
Joined: Tue Sep 17, 2013 4:44 am

creating/running myapp.desktop

Post by davekimble »

Lubuntu 13.04, lxpanel 0.5.12
I have written a GUI application using wxPHP, that I can launch OK from lxterminal:
php ~/path/to/file.wxphp
but I want to launch it from lxpanel's Application Launch Bar.

So I created /usr/share/applications/myapp.desktop :
======
[Desktop Entry]
Name=My-App
Exec=lxterminal "--command=php ~/path/to/file.wxphp"
Icon=some-icon
Categories=Accessories;
Type=Application
Terminal=true
======
but lxpanel's Application Launch Bar editor cannot see /myapp.desktop , (why?).

So I edited ~/.config/lxpanel/Lubuntu/panels/panel
to add:
Button { id=/usr/share/applications/myapp.desktop }
and the button appears OK.

But clicking the button produces a brief screen flicker and that's all -
no window for lxterminal or myapp, no new processes running.

Running the Exec= line in lxterminal works OK (it opens another lxterminal window of course).

Clearly I am missing something here, and I don't know what it is.
Or maybe there is a much easier way of doing things.
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: creating/running myapp.desktop

Post by seppalta »

I assume it appears in the Accessories section of the lxmenu? Does it launch correctly from there?
http://lxlinux.com/#13
davekimble
Posts: 13
Joined: Tue Sep 17, 2013 4:44 am

Re: creating/running myapp.desktop

Post by davekimble »

No,it doesn't appear in Menu > Accessories or in Application Launch Bar editor.
In Dolphin file manager it has the same owner (root) and permissions (-rw-r--r--) as all the other *.desktop .
Double-clicking myapp.desktop in Dolphin works OK.
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: creating/running myapp.desktop

Post by seppalta »

If you get a proper desktop file, the app will appear in the lxmenu, be launchable from there and allow you to put a launcher on the panel in the usual way. So I would fool around with your desktop file, especially the exec part. Some things you might try:

(1) Categories=Utility
(2) Leave out "Terminal= "
(3) Try Exec=php ~/path/to/file.wxphp
(4) Try Exec=x-terminal-emulator -T "php" -e sh -c "~/path/to/file.wxphp"
(5) Try Exec=lxterminal -e ~/bin/tlaunch.sh "php ~/path/to/file.wxphp" , where tlaunch.sh is defined in http://lxlinux.com/#13

Might try (4) and (5) without the quotes as well. (3) is what I use for java, python and perl, but I have never used php. Is your app launched inside or outside the terminal?
davekimble
Posts: 13
Joined: Tue Sep 17, 2013 4:44 am

Re: creating/running myapp.desktop

Post by davekimble »

I have tried lots of variations of Exec= , but thanks for those other options - I will try them.
My app reads a mounted network share, but in case it's not mounted, it tries to mount it.
So it needs a password for 'sudo mount ...' and it needs a password for the network share.
That's why it is seems necessary to 'Exec=lxterminal ...', although I could be wrong.
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: creating/running myapp.desktop

Post by seppalta »

Running the Exec= line in lxterminal works OK
You can always use xdotool to recreate your actions launching by terminal into a shell script and then using that as a menu launcher. See the link that I gave you for details. Also, try a different shell. I have had xterm launch apps (from scripts) that lxterminal just ignored. There are many opportunities for wasting time :D .
davekimble
Posts: 13
Joined: Tue Sep 17, 2013 4:44 am

Re: creating/running myapp.desktop

Post by davekimble »

After a successful reboot, the lxpanel button now works, including mounting the network share.
I say successful reboot because I haven't had a clean reboot for a while, something is causing Ubuntu to have a system crash that it appears to recover from OK.

Is a reboot a necessary part of rebuilding the menu?
There are many opportunities for wasting time :D .
How true, how true.
seppalta
Posts: 449
Joined: Tue Sep 20, 2011 6:09 am
Location: USA
Contact:

Re: creating/running myapp.desktop

Post by seppalta »

Is a reboot a necessary part of rebuilding the menu?
No.
I say successful reboot because I haven't had a clean reboot for a while, something is causing Ubuntu to have a system crash that it appears to recover from OK.

This is only one of the problems that too often occurs with Lubuntu, which is why I gave up on it a few years back.
Locked