My problem is getting a .desktop file that runs a script with parameter(s) in a terminal to stay open rather than blink on and off, presumably taking with it the error messages I need.

I show some simple scripts and .desktops to demonstrate that it should work.

$ cat /home/westmj/GoogleDrive/perl/hello_world.pl
 #! /usr/bin/perl
 print "Hello, World!\n\@ARGV:\n";
 foreach $arg (@ARGV) {
    print "$arg\n";
warn "Press 'Enter' or 'Return' to finish.\n";

$ /usr/bin/perl /home/westmj/GoogleDrive/perl/hello_world.pl 1 a.txt

Hello, World!
Press 'Enter' or 'Return' to finish.

$ cat hello_world_desktop.desktop
[Desktop Entry]
Comment=Execute by dropping file onto
Exec=/usr/bin/perl /home/westmj/GoogleDrive/perl/hello_world.pl '%F'

When the file a.txt is dropped on hello_world_desktop.desktop, a terminal opens with the output shown (note the fullpathname), and waits for a return to be dismissed as before.

Hello, World!
Press 'Enter' or 'Return' to finish.

Now the fun begins. I have a more complex script, but it runs at the command line and takes a filename parameter successfully, and patiently waits to be dismissed.

$ /usr/bin/perl /home/westmj/GoogleDrive/perl/attenders.pl /home/westmj/GoogleDrive/perl/Attenders_database.xls

Input database found in /home/westmj/GoogleDrive/perl/Attenders_database.xls
Made copy of
/home/westmj/GoogleDrive/perl/Attenders_database.xls as
/home/westmj/GoogleDrive/perl/ -
to maintain database history.
Database Version 'August 11, 2016' File suffix '2016_08_Aug_11'
Output directory = /home/westmj/GoogleDrive/perl/

Done with creation of reports.

Press 'Enter' or 'Return' to exit.

And I have a .desktop file that should be using the same invoking:

$ cat attenders_desktop_04.desktop
 [Desktop Entry]
 Comment=Drag and drop onto this the Attenders_database.xls[x] and optionally directory for output
 Exec=/usr/bin/perl /home/westmj/GoogleDrive/perl/attenders.pl '%F'

But if I drag Attenders_database.xls onto attenders_desktop_04.desktop, all that happens is a terminal briefly opens and closes.

I do not think it is a matter of permissions.

$ ls -la *.desktop
-rwxrw-r-- 1 westmj westmj 411 Sep 16 21:55 attenders_desktop_04.desktop
-rwxrw-r-- 1 westmj westmj 340 Sep 16 21:52 hello_world_desktop.desktop

What now? Thanks for any advice.

  • Your question is related to this one: askubuntu.com/q/744658/295286 Basic idea is that .desktop files flash because they wait for a window to appear. If script doesn't show a window, it keeps flashing until it times out. Also, note that .desktop files for scripts do not automatically bring up terminal window. You need to call them manually. Or use my answer here, to launch scripts with terminal window from file manager askubuntu.com/a/822874/295286 Sep 17, 2016 at 10:58


You must log in to answer this question.

Browse other questions tagged .