Author Topic: Need some scripting advice  (Read 833 times)

Snap

  • Posts: 488
    • View Profile
Need some scripting advice
« on: September 21, 2015, 02:01:18 PM »
As you may know, I recently switched my main system from a KDE based one to a Boxes thing. There's one thing I'm missing. In KDE I had the habit of dragging URLs from the browser to Dolphin and it creates a desktop file for the link like this:

Code: [Select]
[Desktop Entry]
Icon=unknown
Name=https://www.youtube.com/watch?v=ZMiyeNxcBSY
Type=Link
URL[$e]=https://www.youtube.com/watch?v=ZMiyeNxcBSY

They don't work outside KDE, but I found this way to tweak them to work anywhere.

Code: [Select]
[Desktop Entry]
Icon=emblem-symbolic-link
Name=https://www.youtube.com/watch?v=ZMiyeNxcBSY
Type=Link
#For Dolphin
#URL[$e]=https://www.youtube.com/watch?v=ZMiyeNxcBSY
Exec=iceweasel [youtube]https://www.youtube.com/watch?v=ZMiyeNxcBSY[/youtube]

Damnit, the [youtube] things shouldn't be there, but cannot get rid of them. Sorry.

I left the KDE leftover code commented just in case. I'll have to modify tons of them, but I will go over them as I need them. Not in a hurry.

The thing is. I'd like to keep throwing URLs into my file manager (spacefm). I need a script pasting or parsing a highlighted or clipboard URL into that kind of desktop file pattern. just filling the gaps. Or maybe (even better?) a spacefm plugin. The problem is I don't know where to start. What would be the bash commands to use in this situation? I mean, to fill the "gaps" in a file pattern/stencil like this?

Code: [Select]
[Desktop Entry]
Icon=emblem-symbolic-link
Name="Highlighted-or-clipboard-URL" -- or even better the script asking for a name here and to save the file under the-same-name.desktop.
Type=Link
#For Dolphin
#URL[$e]="Highlighted-or-clipboard-URL" -- these KDE lines might be skipped.
Exec=iceweasel "Highlighted-or-clipboard-URL"

Any kind of guidance and/or strategy will be welcome for a lifetime.

Thanks in advance.