Page 1 of 1

How do I start a terminal program from the start menu?

Posted: Sun May 20, 2018 8:59 pm
by ChrisHvide
Hi there.
I need to open a node.js script with the terminal from the start menu.
I tried this, which doesn't work:
mate-terminal -e "node /home/chris/.SMLoadr/SMLoadr.js"
Any idea how I can do this?

Re: How do I start a terminal program from the start menu?

Posted: Mon May 21, 2018 9:07 am
by ChrisHvide
BUMP

Re: How do I start a terminal program from the start menu?

Posted: Mon May 21, 2018 9:33 am
by Flemur
ChrisHvide wrote:
Sun May 20, 2018 8:59 pm
I tried this, which doesn't work:
mate-terminal -e "node /home/chris/.SMLoadr/SMLoadr.js"
Any idea how I can do this?
It sounds simple, and it should be simple, but it's a bit of a PITA.

For instance...
File "aaa" is executable and in my PATH, and is:

Code: Select all

echo $HOME
ls -l $HOME

Code: Select all

xfce4-terminal -e="aaa"
--> nothing happens; no terminal flashes up.

Change aaa to

Code: Select all

echo $HOME
ls -l $HOME
read 
and another terminal pops up with $HOME shown and the "ls" output is shown. Pretty lame, huh?
It works if the script puts up a GUI (content of aaa = "gimp"), or waits for input...

Edit:
https://askubuntu.com/questions/484993/ ... nal-window
There's

Code: Select all

xfce4-terminal  --hold -e="aaa"
which leaves the new window up til you close it, but there's no output from the "aaa" command w/o the 'read' at the end. Pretty lame, huh?

So here's my free advice: make a two-line executable script in your PATH (call it "doit")

Code: Select all

node /home/chris/.SMLoadr/SMLoadr.js
read
Then try

Code: Select all

mate-terminal -e "doit"
Or you could play with the ludicrous -x sh -c "!!; bash syntax at that link.

Re: How do I start a terminal program from the start menu?

Posted: Mon May 21, 2018 12:28 pm
by ChrisHvide
Ah of course I can do it like that.
Thank you so much :)

Re: How do I start a terminal program from the start menu?

Posted: Wed May 23, 2018 7:42 pm
by cabbagetreemo
Another method, which worked on Cinnamon is to create a bash file /path/to/your/bash/file which executes your terminal commands. Make it executable

Code: Select all

chmod u=rwx /path/to/your/bash/file
and then create a file in /usr/share/application/<name>.desktop where <name> can be whatever you want

The contents of the file should look like

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Exec=/path/to/your/bash/file
Icon=/path/to/an/image #(A path to a .png file which will supply the icon in the menu)
Type=Application
Terminal=false
Comment= #I think you can put more or less anything here, something descriptive would be good
Name= #The name you want to appear in the menu
GenericName= #I don't think this matters
StartupNotify=false
Categories= #Which ever submenu is appropriate e.g. Office