2

I have a xfreerdp connection file like:

xfreerdp /v:10.1.60.151 -sec-nla /cert-ignore

The file name is test.rdp and I can run it with bash in a terminal with the command bash test.rdp

But I need to run this file from GUI with double click.

I'm tryng to set bash as default to open *.rdp files but I couldn't figure out I can do that. I don't mind changing the filename extension

I also want to know if I can run this file directly when I download with Chrome.

muru
  • 197,895
  • 55
  • 485
  • 740
Morphin
  • 131
  • Rereading your question and your further comments I am a bit confused about your usercase.

    Is this file something that users need to download and use on your server (e.g. while they are connected with their own user to your linux machine?)? Or are they supposed to download and run on their own computer?

    – Three Diag Nov 07 '16 at 10:54
  • 5
    Your question probably already has an answer here: http://askubuntu.com/questions/138908/how-to-execute-a-script-just-by-double-clicking-like-exe-files-in-windows

    tl;dr: There is nothing in unix systems that allow you to do the same as .bat file (download it and double click it). Users will always have to set the default in their machine to make it clickable in one of the ways described in the article. If you have control on their environment (i.e. they are on your server) then you can set the default behavior for them othw. you are better off instructing them on using the shell to launch.

    – Three Diag Nov 07 '16 at 11:03
  • @ThreeDiag I have a User web site and people downloading their own RDP files from there. People can directly open RDP files from Windows and im triying to make same thing as Linux. But i think there is no way to do that. And because of that i'm trying to do set default program for *.rdp files. And the file only needs to run at terminal like. "bash test.rdp" Sorry for my english. – Morphin Nov 07 '16 at 12:01
  • I am afraid not, as the handling of default filetype will be different on each machine/distribution. Your best bet is probably to add a little explanation on your site on how to launch the script in a Linux environment. – Three Diag Nov 07 '16 at 12:03
  • @ThreeDiag I need to launch first than :) – Morphin Nov 07 '16 at 12:41

2 Answers2

1

I found my solution: I created a .desktop file at /home/USERNAME/.local/share/applications/morphin.desktop

[Desktop Entry]
Encoding=UTF-8
Name=Morphin
Exec=/opt/scripts/morphin.sh
Icon=/opt/scripts/morphin.png
Type=Application
NoDisplay=false
Terminal=false
StartupNotify=true
Categories=Application;Network;
Hidden=true

Finally I can see my program in other programs and I can launch it.

Zanna
  • 70,465
Morphin
  • 131
0

Not tested, but if you add

#! /bin/bash
#

at the top of your file and make it executable with chmod +x file it should be runnable by double click from the (most of?) filemanagers.

Rmano
  • 31,947
  • Nope. Opening with "vim". And users downloading this file from https, i cant give chmod everytime. – Morphin Nov 07 '16 at 09:38
  • Hmmm... could http://rlog.rgtti.com/2010/11/22/integrating-a-new-application-in-gnome/ help? – Rmano Nov 07 '16 at 09:41