While using Google Chrome I often drag website links from the address bar into a folder on the desktop for later reference. This creates a .desktop
file that is essentially a link to a webpage.
These desktop files can be opened easily from Nautilus & PCmanFM by simply by double-clicking to open them, however, when I open them using the SpaceFM file manager, Google Chrome starts downloading the file instead of opening it like it does with the other mentioned file managers.
I am able to open these files through SpaceFM if I right click them and open with Firefox, but not Google Chrome.
An example of the desktop file would be as follows:
[Desktop Entry]
Encoding=UTF-8
Name=Link to The Hidden Fortress (1958) - IMDb
Type=Link
URL=http://www.imdb.com/title/tt0051808/?ref_=nv_sr_2
Icon=text-html
Is there a way to make these .desktop
files open in Google Chrome normally when launched from the SpaceFM browser?
1. Convert link files into launchers
The solution below offers the option to right- click the link (
.desktop
file) and choose > "Execute", which will runGoogle-Chrome
to open the link. By editingSpaceFm
's settings, you can run the link by double-click as well (see notes[3]
).Note that the solution automatically edits (only) new links on your desktop, to run the link specifically with
Google-Chrome
What it is
A small background script checks once per two seconds for new
.desktop
files on your Desktop. If a relevant file is found, the file is edited from a Link file into an Application file. This is done by editing two lines inside the file:The line:
is changed into:
The line:
is changed into:
In the test(s) I ran, this makes the link "openable" by right- click in
SpaceFm
: right-click > Open > ExecuteThe script
How to use
edit_links.py
Check the command to run
Google-Chrome
(also set in the head- section) by checking the firstExec=
line in thegoogle-chrome.desktop
file: runto read the file.
Test-run the script by the command:
Open
Google-Chrome
, drag links on to your Desktop, test after a few seconds if it works fine.If all works fine, add it to Startup Applications: Dash > Startup Applications > Add. Add the command:
Note
.desktop
file (link) needs to be on your Desktop at least one-two seconds to be found and edited, so if you move the links, at least leave them for a few seconds on your Desktop. :).desktop
files on your Desktop, it only reads/edits the file(s) if there are new files. This means nothing to your system.By editing
SpaceFm
's settings, you can alsu run the "link" by double-click:Convert your existing link files recursively
Additionally, as discussed in chat, a script to run a single time to convert the links in a directory recursively:
To use it, save it as
convert_links.py
, run it with the targeted directory as an argument:2. Convert links into cross-platform usable link files
As requested by OP, below a version of the (first) (background) script, converting the link files, created by dragging a link from the browser to the desktop, into cross-platform links. Usage is exactly as explained in the first section.
The script
Version to convert your existing links in a recursive directory (single run)
To use it, save it as
convert_links.py
, run it with the targeted directory as an argument:Note
This version was based on this nice answer on Super User to create cross-platform links.