Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] [solved]lxde desktop shortcut problem  (Read 5359 times)

krisbee

  • Guest
[EN] [solved]lxde desktop shortcut problem
« on: 2013/02/15, 11:24:53 »
I want to launch a bash script from a lxde desktop shortcut. e.g

Code: [Select]
[Desktop Entry]
Encoding=UTF-8
Name=Test
Comment=Test launch script
#Exec=sh /home/chris/mytest.sh
Exec=lxterminal --working-directory=/home/chris -e "sh mytest.sh"
Terminal=false
Type=Application
StartupNotify=true


Code: [Select]
-rwxr-xr-x 1 chris chris        34 Feb 15 09:42 mytest.sh

But my simple test does not work with either of the "exec" lines above. In the case of the "Exec=lxterminal..", a terminal just flashes briefly on screen. While the "Exec=sh ..." does nothing.


What is the correct way to do this?

Offline dieres

  • User
  • Posts: 786
[solved]lxde desktop shortcut problem
« Reply #1 on: 2013/02/15, 13:44:48 »
did you already try terminal=true ?

krisbee

  • Guest
[solved]lxde desktop shortcut problem
« Reply #2 on: 2013/02/15, 17:06:44 »
Yes.  If I use "Exec=sh ..." I set "Terminal=true", which seemed logical but either way the simple test scipt is not executed.

Offline spacepenguin

  • User
  • Posts: 862
    • spacepenguin.de
[solved]lxde desktop shortcut problem
« Reply #3 on: 2013/02/15, 18:51:43 »
I don't know if lxterminal has a "hold" function...?
Alternative: xterm

Exec=xterm -hold -e 'your command'

Edit:
Exec=lxterminal --command='bash -c "your command"'
Susan | Hardware: SysProfile
Music-Profile: http://www.last.fm/de/user/spacepengu

krisbee

  • Guest
[solved]lxde desktop shortcut problem
« Reply #4 on: 2013/02/16, 11:30:20 »
Clearly I need to learn more about terminals, shells etc.

Your ref to "xterm -hold" made me realise my "Exec=lxterminal.." line was just creating a window that destroyed itself without visible output.

In fact it's worse than that, if I use your second example and the command was just a simple "ls -l" then the lxterminal window just flashes on screen. But, if the Exec line in the desktop file is for example:

E
Code: [Select]
xec=lxterminal --working-directory=/home/chris/ -e "./mytest"

and mytest is:

Code: [Select]
#!/bin/bash
ls -l
echo " "
read -s -r -p "Press any key to exit...  " -n 1
echo ""


You finally get an Lxterminal with output that only destroys itself after a key press.

My big mistake was I thought the lxterminal man pages meant you could open a lxterminal at a given working directory, automatically run a command/script with the usual shell prompt.  It doesn't work that way.

Offline spacepenguin

  • User
  • Posts: 862
    • spacepenguin.de
[solved]lxde desktop shortcut problem
« Reply #5 on: 2013/02/16, 13:55:02 »
Quote from: "krisbee"
if I use your second example and the command was just a simple "ls -l" then the lxterminal window just flashes on screen.


Ok, I'd tested it with "/usr/bin/htop" as command and that worked with the "command bash" combination (not without the bash -c addition and not without command=), the lxterminal window stayed open. When I use "ls -l" as you said, it does not... The latter only works as

Code: [Select]
Exec=lxterminal --commmand='bash -c "ls -l && read -p \"\""'

Lxterminal is a fast but rather basic terminal client...

Glad to see you found a solution.
Susan | Hardware: SysProfile
Music-Profile: http://www.last.fm/de/user/spacepengu