1

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";
<STDIN>

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

Hello, World!
@ARGV:
1
a.txt
Press 'Enter' or 'Return' to finish.

$ cat hello_world_desktop.desktop
#
[Desktop Entry]
Version=1.0
Name=Hello_World_desktop
Comment=Execute by dropping file onto
Exec=/usr/bin/perl /home/westmj/GoogleDrive/perl/hello_world.pl '%F'
Terminal=true
Type=Application
MimeType=application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;inode/directory;text/plain;text/x-script.perl;

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!
@ARGV:
/home/westmj/GoogleDrive/perl/a.txt
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/ -
2016_08_Aug_11_/home/westmj/GoogleDrive/perl/Attenders_database.xls
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]
 Version=1.0
 Name=attenders_desktop_04
 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'
 Terminal=true
 Type=Application
 MimeType=application/vnd.ms-excel;application/vnd.ms-office;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;inode/directory;application/zip;

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.

1
  • 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

0

You must log in to answer this question.

Browse other questions tagged .