elementary / applications-menu

Applications Menu for elementary OS and the Pantheon desktop environment
https://elementary.io
GNU General Public License v3.0
103 stars 36 forks source link

Entering bash command does not work #53

Open theotheroracle opened 7 years ago

theotheroracle commented 7 years ago

I recently installed UCK which is required to run by default in the terminal. however, elementary would not launch this program as any program with the "Launch in terminal" option checked does not launch. not sure what the problem is but, I assumed it might be the menu.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/51136004-entering-bash-command-does-not-work?utm_campaign=plugin&utm_content=tracker%2F62023936&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F62023936&utm_medium=issues&utm_source=github).
theotheroracle commented 7 years ago

to clarify, I installed AppEditor to check if this option was checked by default.

theotheroracle commented 7 years ago

I installed another terminal, xterm, to test if I could launch xterm with a program as an argument. then I tested to see if the "launch in terminal" option worked, and it did. so I guess the problem is that xterm should be installed by default? or should pantheon terminal support command arguments?

theotheroracle commented 7 years ago

perhaps the menu could give you a warning when a problem like this occurs? telling them that they can launch the program without the terminal, or to install xterm?

jeremypw commented 7 years ago

Perhaps this is related: https://github.com/elementary/terminal/issues/158

theotheroracle commented 7 years ago

ok. I will post this there as well.

--

-PiFi 🍍

jeremypw commented 6 years ago

Terminal does need to be launched with fairly strict requirements for the --execute flag at the moment. The app menu needs to be checked that it is complying.

queeup commented 5 years ago

Any news? I hate this bug. I Can't use Super key+space and keyboard to start some terminal commands.

Just in case I will put this here:https://github.com/mate-desktop/mate-panel/issues/57

jeremypw commented 5 years ago

Sorry this does not seem to have attracted any attention. I'll try and look into it soon.

jeremypw commented 5 years ago

I can confirm that UCK does not launch unless an alternative terminal is installed.

At the moment the appmenu launches the app using a Gtk.AppInfo with a NEEDS_TERMINAL flag so it looks like that is not compatible with the elementary terminal.

jeremypw commented 5 years ago

Part of the problem seems to be that the environment variable "TERM" is set to "xterm" not "io.elementary.terminal"

jeremypw commented 5 years ago

Unfortunately making sure that TERM=io.elementary.terminal in the environment with which appinfo.launch () is called makes no difference - Gtk still tries to launch in "xterm" - which fails if that is not installed. Not sure yet why this is.

jeremypw commented 5 years ago

Installing other terminals which are not named "xterm" (e.g. Mate terminal or Konsole) also causes this problem. May be an upstream issue - the terminal set in the environment is not being used by Gtk.

jeremypw commented 5 years ago

It may be possible for the application menu to work around this by reading the settings itself and constructing the correct commandline. Whether this is the correct approach rather than fixing upstream is open to question.

jeremypw commented 5 years ago

A workround for this particular case is to create a custom shortcut using the keyboard settings plug.

This command works: io.elementary.terminal -e uck-gui --wait-before-exit

That way you can launch the app with e.g. <Alt>U or whatever shortcut you would like that does not clash with an existing one.

queeup commented 5 years ago

Yes It's not looking very attractive but It gives a lot of power to app menu. And make it fast app launches.

You mean modify applications .desktop files "Exec=" key manually? There must be a better way :(

jeremypw commented 5 years ago

@queeup What I mean is

queeup commented 5 years ago

Ooo boy. Please don't make me do this. :(

I hope this powerful feature of app menu can be fixed someday.

queeup commented 5 years ago

OK just to be sure we are talking about same things and two different problems:

I want to point out .desktop files with Terminal=true key applications (Htop for example) not working unless xterm installed or fake it like you have installed with ln -s /usr/bin/io.elementary.terminal /usr/bin/xterm.

"Launch in terminal" is looking like the same thing but code base different thing. That is why symbolic link trick not working on this.

Two different problem for doing almost same job. Do I need to open another issue for "Terminal=true" apps?

queeup commented 5 years ago

For the Terminal=true thing need gnome patch like mate team did:

Problem is this lines:

Strange but "Launch in terminal" accualy works but printing commands result to the to DEBUG log instead open terminal and pring on it.

python3 --version command from app menu::

** (wingpanel:6568): DEBUG: 00:35:23.362: relevancy-service.vala:72: application launched
Python 3.6.8

uname -a command from app menu:

** (wingpanel:6568): DEBUG: 00:49:48.198: relevancy-service.vala:72: application launched
Linux sony-desktop 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
jeremypw commented 5 years ago

Not sure whether https://github.com/elementary/terminal/pull/397 might help with this.

jeremypw commented 5 years ago

@queeup I think that if the issues are due to bugs in different parts of the code and require separate solutions (as appears to be the case) then two issue need to be opened.

jeremypw commented 5 years ago

@queeup Just to clarify - when you say "Launch in Terminal" ticked, which app is supplying this option?

queeup commented 5 years ago

Sorry for confusing. I mixed up things. When I say "Launch in Terminal" I was trying to say "Run command". Write terminal command (ls -ll or cat .bashrc etc.) to app menu and expected to see terminal window opening and print out commands results on terminal. I think I am wrong about that right? There is no such a thing.

I guess my #232 issue is duplicate of this issue. I am confused. Sorry. You can tag it as duplicate.

jeremypw commented 5 years ago

In that case I think #232 may well be a duplicate, however I think the problem is more clearly state in that report as it mentions the problem is fundamentally linked to the "Terminal" key in the desktop file.

jeremypw commented 5 years ago

I have changed the description of this to distinguish it from #232. I am looking into the related code and it may have a different cause in the case of bash commands as opposed to apps requiring a terminal.

jeremypw commented 5 years ago

It seems that if wingpanel is launched from a terminal (it needs to be removed from cerbere monitor list and killed first), the entering a bash command produces output in that terminal rather than launching a new terminal which would explain why it is not normally seen.

jeremypw commented 5 years ago

After further investigation, I think that the root cause of all these problems is gdesktopappinfo only supporting specific named terminal programs before falling back to xterm (not including io.elementary.terminal). So until that problem is fixed we can only try and find a work around.