Start Menu Items - Cannot add a bash command?

Having recently done an Devuan version upgrade, now with Kde Plasma 5.27.5, I find I cannot add an item like this as a start menu item :

gpg -d /home/bolingbroke/secrets.gpg |less

The previous kde version I was using allowed me to specify a complete command line such as the one above. Now however the menu editor splits the command into a “Program” field and a “Command-Line Arguments” field. I have tried putting “gpg” in the “Program” field and the rest in the the “Command-Line Arguments” field, and also tried putting it all in the “Program” field. I have also tried omiting the “|less”. But the best I get is a brief flash of a terminal window.

The above command works fine in a terminal. In the “Advanced” tab of the menu editor I have the “Run in Terminal” tab ticked of course.

It is frustrating that the Start Menu is less powerful than before, or am I missing something?

The only way I can manage to do this is to create a .desktop file that is a link to a bash script with the commands inside.

Anything you run this way will automatically exit the terminal as soon as it completes, so all you might see is a flash of the terminal window, if you even see that.

I won’t post a link to it here, but if you search for my username on github, I have a page for “zup” that will show you how I managed to do it. The bash script starts with a special shebang. It took me a while to figure it all out.

As Wilson pointed out, you might wanna use a script for this one. There are certain things you can start straight up ( like, say, start a conky pointing to an rc file) but some don’t. Put the command in a bash script and see what gives.

1 Like

Thanks for the replies. I have now created a simple bash script with the full command line in it, and I edited the kde start menu entry simply to invoke the name of the script. The terminal window does stay open and pgp asks for the password in a separate small GUI window (surprisingly). This is different from when I start pgp in a terminal, in which it asks for the password within the terminal, but the difference no big deal.

I don’t know why the kde menu “upgrade” needed to disable the ability to have a full command line in it - was it an attempt to dumb things down, or is it just a bug?

the pipe (symbol) might be the cause of your problem.

may i suggest to use konsole as command and the following as the arguments in the menu editor:

-e 'bash -c "gpg -d /home/bolingbroke/secrets.gpg | less"'

bash is probably not necessarily required in this example, but if u wanna append the line with some internal stuff such as read -t 5

1 Like

Yes Chartman, that works too :slightly_smiling_face:

But BTW the pipe symbol was not the problem (or all the problem) because I did try it without the pipe and it still did not work.

It’s as poweful as before, just different. And for a good reason. The Desktop Entry Specification specifies the relevant part as “an executable program optionally followed by one or more arguments”. That’s very different to a full bash script.

The fact that specifying a bash script worked is more of an accidental implementation detail, and caused problems with interoperability with other software that reads this and have a stricter implementation. That’s why the UI was redone to make this more obvious.

That said you don’t need a separate script file. You can specify “bash” as the program and “-c ‘your | bash | script’” as arguments

2 Likes