[SOLVED] LM20 - prefer clean filenames without: "link to"
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
[SOLVED] LM20 - prefer clean filenames without: "link to"
All the urls you save by pulling them from the browser into a folder get the name: link to etc.
It is of no use whatsoever to have these files named starting with "link to".
How to get automatically clean filenames with just the title of the saved webpage?
It is of no use whatsoever to have these files named starting with "link to".
How to get automatically clean filenames with just the title of the saved webpage?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
Re: prefer clean filenames without: "link to"
How are you doing that? (I've never done it and don't see a mechanism in FF, anyway).Pepper-Mint-Patty wrote: ⤴Thu Feb 06, 2020 12:08 pm All the urls you save by pulling them from the browser into a folder get the name: link to etc.
Have you tried renaming the files?
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Your data and OS are backed up....right?
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
On Linux Mint 19.2
just pull the 'lock' in FF adress menu into any folder.
2 Yes you can manually rename the +10s files. But why should this be done by hand, i think we are using a computer...
just pull the 'lock' in FF adress menu into any folder.
2 Yes you can manually rename the +10s files. But why should this be done by hand, i think we are using a computer...
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
- AZgl1800
- Level 20
- Posts: 11170
- Joined: Thu Dec 31, 2015 3:20 am
- Location: Oklahoma where the wind comes Sweeping down the Plains
- Contact:
Re: prefer clean filenames without: "link to"
I have never had what you describe happen.
this is what I see for this thread with a copy/paste from the URL line.
posting.php?mode=reply&f=47&t=311595
this what I get when I paste the above into Ted.
posting.php?mode=reply&f=47&t=311595
looks the same to me.
this is what I get when I bookmark this thread in FF, and then open Recently bookmarked items, and the copy the link.
posting.php?mode=reply&f=47&t=311595
they all look the same to me.
this is what I see for this thread with a copy/paste from the URL line.
posting.php?mode=reply&f=47&t=311595
this what I get when I paste the above into Ted.
posting.php?mode=reply&f=47&t=311595
looks the same to me.
this is what I get when I bookmark this thread in FF, and then open Recently bookmarked items, and the copy the link.
posting.php?mode=reply&f=47&t=311595
they all look the same to me.
- smurphos
- Level 18
- Posts: 8498
- Joined: Fri Sep 05, 2014 12:18 am
- Location: Irish Brit in Portugal
- Contact:
Re: prefer clean filenames without: "link to"
Hi,Pepper-Mint-Patty wrote: ⤴Thu Feb 06, 2020 12:53 pm On Linux Mint 19.2
just pull the 'lock' in FF adress menu into any folder.
2 Yes you can manually rename the +10s files. But why should this be done by hand, i think we are using a computer...
I'm not aware of a way to change the default behaviour of dragging a url to to the Desktop or File Manager but assuming you are still using nemo / cinnamon you can add a custom right click context menu to manually make URL links named as you wish as a Nemo Action
E.g
Result
To add the Nemo Action copy and paste these four commands in full to a terminal window.
Make a scripts subdirectory in the nemo actions directory
Code: Select all
mkdir -p ~/.local/share/nemo/actions/scripts
Code: Select all
tee ~/.local/share/nemo/actions/add_URL_link_here.nemo_action <<'EOB'
[Nemo Action]
# An action to create a URL link in the current directory
Name=Add _URL Link
Comment=Create a URL in %P
Exec=<scripts/add_URL_link_here.sh %P>
Icon-Name=insert-link-symbolic
Selection=none
Extensions=none;
EOB
Code: Select all
tee ~/.local/share/nemo/actions/scripts/add_URL_link_here.sh <<'EOB'
#!/bin/bash
#Set destination directory
DEST="$1"
if [ -z "$DEST" ]; then
exit 1;
fi
#Confirm name of link
NAME=$(zenity --entry --width=250 --title "URL Link name" --text="Confirm link name" --entry-text="URL Link to" )
if [ -z "$NAME" ]; then
exit 1;
fi
#Confirm URL of link
URL=$(zenity --entry --width=250 --title "URL" --text="Input URL" --entry-text="https://" )
if [ -z "$URL" ]; then
exit 1;
fi
#Double check not overwriting an existing file or directory
if [ -e "$DEST/$NAME".desktop ]; then
notify-send --expire-time=200000 "Error creating URL link. $DEST/$NAME already exists. Try again."
exit 1
fi
echo -e "[Desktop Entry]\nName=$NAME\nURL=$URL\nComment=\nTerminal=false\nIcon=text-html\nType=Link" > "$DEST/$NAME".desktop
chmod u+x "$DEST/$NAME".desktop
if [ $? = 1 ]; then
notify-send --expire-time=200000 "Error creating link. Try again."
exit 1
else
notify-send --expire-time=200000 "Successfully created link $DEST/$NAME"
exit 0
fi
EOB
Code: Select all
chmod +x ~/.local/share/nemo/actions/scripts/add_URL_link_here.sh
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
Thanks for the help so far. But i am looking for a simple, haslefree way to drag url links into folders. No right and left clicking and renaming etc.
I don't like to mention but in Windows this is default and as simple as that.
But in Mint the filename is for example:
Link to Linux Mint Forums - Index page
Opening this file in text editor shows
[Desktop Entry]
Encoding=UTF-8
Name=Link to Linux Mint Forums - Index page
Type=Link
URL=index.php
Icon=text-html
So how to make the filename by default not show the "Link to" text?
I don't like to mention but in Windows this is default and as simple as that.
But in Mint the filename is for example:
Link to Linux Mint Forums - Index page
Opening this file in text editor shows
[Desktop Entry]
Encoding=UTF-8
Name=Link to Linux Mint Forums - Index page
Type=Link
URL=index.php
Icon=text-html
So how to make the filename by default not show the "Link to" text?
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
- smurphos
- Level 18
- Posts: 8498
- Joined: Fri Sep 05, 2014 12:18 am
- Location: Irish Brit in Portugal
- Contact:
Re: prefer clean filenames without: "link to"
So the behaviour you want to change is hardcoded in Nemo (Cinnamon) and Caja (Mate) so the only way to change it would be to download the sources, amend and recompile. I'm pretty sure I know what would need to be changed in Nemo, I haven't looked at Caja. Let me know if you want to go there and I will test and post instructions if I can work it out. Obviously need confirmation of which desktop environment you are using.Pepper-Mint-Patty wrote: ⤴Sat Feb 08, 2020 8:08 am So how to make the filename by default not show the "Link to" text?
XFCE/Thunar the behaviour is different - when you drag the link to the desktop or the file manager it pops up a dialogue allowing you to specify the name of the link. tweak the URL, and if you want change the icon prior to creation. The default name does not have Link to, so you can pretty much drag drop and hit enter to confirm the defaults.
If you are not using XFCE, but are trying to make your links in a file manager window rather than on the desktop a workaround would be install Thunar in addition to your regular File Manager and then drag your links into a Thunar Window.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
Very much appreciated!
this comes up: Nemo 4.2.3 lets you organize files and folders, both on your computer and online.
this comes up: Nemo 4.2.3 lets you organize files and folders, both on your computer and online.
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
hi smurphos, is this the info you needed? Nemo 4.2.3
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
- smurphos
- Level 18
- Posts: 8498
- Joined: Fri Sep 05, 2014 12:18 am
- Location: Irish Brit in Portugal
- Contact:
Re: prefer clean filenames without: "link to"
Thanks,Pepper-Mint-Patty wrote: ⤴Wed Feb 19, 2020 6:57 am hi smurphos, is this the info you needed? Nemo 4.2.3
I'll take a look over the weekend.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
Marvellous!
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
Re: prefer clean filenames without: "link to"
When I dragged the lock icon from firefox into pcmanfm, nothing happened (the drag window bounced back).Pepper-Mint-Patty wrote: ⤴Sat Feb 08, 2020 8:08 am So how to make the filename by default not show the "Link to" text?
When I dragged it into thunar, it asked me for the file name, I enter "mint" and get a file named "mint.desktop" with this content:
Code: Select all
[Desktop Entry]
Version=1.0
Type=Link
Name=mint
Comment=
Icon=user-bookmarks
URL=https://forums.linuxmint.com/viewtopic.php?f=47&t=311595
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Your data and OS are backed up....right?
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
@Flemur Like i said before: too much of a hasslePepper-Mint-Patty wrote: ⤴Thu Feb 06, 2020 12:53 pm Yes you can manually rename the +10s files. But why should this be done by hand, i think we are using a computer...
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
- smurphos
- Level 18
- Posts: 8498
- Joined: Fri Sep 05, 2014 12:18 am
- Location: Irish Brit in Portugal
- Contact:
Re: prefer clean filenames without: "link to"
Hi - so here are the steps to modify Nemo's source code to remove the Link to on drag and dropped links from the browser. The change only applies to Drag and Drop links, not links make via the context menu Make Link option.
For other readers note that some of the commands include a version string specific to the Nemo version - bear that in mind if using this as a guide to modify a different version of Nemo
Open Software Sources from the menu and check to include
Open a terminal window and;
1) Make a working directory and enter it
2) Download the nemo source code
3) Enter the source code subdirectory
4) Install build dependencies
5) Open the file we need to modify in a text editor
In the text editor search for the line below (it's line 125)
and change it to
Save the file and close the text editor.
6) Back in the terminal window now we will rebuild nemo. This step will produce a lot of output and an warning at the end about failing to sign the package. You can safely ignore that.
7) Then install the deb packages we've just made.
Close the terminal, log off, log back on and test what you get Dragging and Dropping from the browser.
For other readers note that some of the commands include a version string specific to the Nemo version - bear that in mind if using this as a guide to modify a different version of Nemo
Open Software Sources from the menu and check to include
Source Code Repositories
Open a terminal window and;
1) Make a working directory and enter it
Code: Select all
mkdir -p $HOME/nemo-dnd-mod; cd $HOME/nemo-dnd-mod
Code: Select all
apt source nemo
Code: Select all
cd nemo-4.2.3+tina
Code: Select all
apt build-dep nemo
Code: Select all
xed $HOME/nemo-dnd-mod/nemo-4.2.3+tina/src/nemo-view-dnd.c
Code: Select all
link_display_name = g_strdup_printf (_("Link to %s"), link_name);
Code: Select all
link_display_name = g_strdup_printf (_("%s"), link_name);
6) Back in the terminal window now we will rebuild nemo. This step will produce a lot of output and an warning at the end about failing to sign the package. You can safely ignore that.
Code: Select all
apt build
Code: Select all
cd ..; apt deb *.deb
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
hi smurphos, thanks for the effort! Later this week, with some friends help we will install the commands.
Ill come back to you when done.
Ill come back to you when done.
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
hi smurphos, we finally had time to install youre script. Must say it worked a treat! Delighted with the result!
We made a command to clean the existing 100s of links too:
Open terminal in the folder and
sed -i 's/Link to //' *.desktop
The app we needed to install is almost 300mb. (how) can we remove it?
We made a command to clean the existing 100s of links too:
Open terminal in the folder and
sed -i 's/Link to //' *.desktop
The app we needed to install is almost 300mb. (how) can we remove it?
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
Re: prefer clean filenames without: "link to"
When I suggestedPepper-Mint-Patty wrote: ⤴Tue Mar 10, 2020 2:36 pm We made a command to clean the existing 100s of links too:
Open terminal in the folder and
sed -i 's/Link to //' *.desktop
did you actually think you had to do it one file at a time?Have you tried renaming the files?
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Your data and OS are backed up....right?
- smurphos
- Level 18
- Posts: 8498
- Joined: Fri Sep 05, 2014 12:18 am
- Location: Irish Brit in Portugal
- Contact:
Re: prefer clean filenames without: "link to"
You can delete the working folder we made (that's about 140 MiB) after installation.Pepper-Mint-Patty wrote: ⤴Tue Mar 10, 2020 2:36 pm The app we needed to install is almost 300mb. (how) can we remove it?
Code: Select all
rm -f $HOME/nemo-dnd-mod
apt build-dep nemo
command then unless you took note of what was installed at the time, I think the safest way to identify what can be uninstalled again is via reference to your apt logs. Take a look at the log /var/log/apt/history.log and search for the string build-dep. Beware this log file is only ever for the current month. Older logs are in compressed files in /var/log/apt/On my current install I'd first built nemo back in January but in one of the compressed logs I found this which lists all the packages the command installed. I'd need to manually copy paste the package names to an
apt purge
and would want to double check the output before confirming the command.Code: Select all
Start-Date: 2020-01-07 06:45:02
Commandline: apt-get build-dep nemo
Requested-By: steve (1000)
Install: libgirepository1.0-dev:amd64 (1.56.1-1), docbook-to-man:amd64 (1:2.0.0-41, automatic), libnotify-dev:amd64 (0.7.7-3), highlight:amd64 (3.41-1, automatic), libxt-dev:amd64 (1:1.1.5-1), libffi-dev:amd64 (3.2.1-8, automatic), docbook-xsl:amd64 (1.79.1+dfsg-2, automatic), meson:amd64 (0.45.1-2ubuntu0.18.04.1), libxapp-dev:amd64 (1.6.8+tricia), highlight-common:amd64 (3.41-1, automatic), libosp5:amd64 (1.5.2-13ubuntu2, automatic), libgail-3-dev:amd64 (3.22.30-1ubuntu4), gobject-introspection:amd64 (1.56.1-1), libgtk-3-doc:amd64 (3.22.30-1ubuntu4), libexempi-dev:amd64 (2.4.5-2), opensp:amd64 (1.5.2-13ubuntu2, automatic), libxml2-dev:amd64 (2.9.4+dfsg1-6.1ubuntu1.2), libxklavier-dev:amd64 (5.4-3, automatic), python-pkg-resources:amd64 (39.0.1-2, automatic), libglib2.0-doc:amd64 (2.56.4-0ubuntu0.18.04.4), dh-python:amd64 (3.20180325ubuntu2), libgnomekbd-dev:amd64 (3.26.0-3ubuntu0.18.04.1, automatic), gtk-doc-tools:amd64 (1.27-3), ninja-build:amd64 (1.8.2-1, automatic), python-funcsigs:amd64 (1.0.2-4, automatic), libxkbfile-dev:amd64 (1:1.0.9-2, automatic), libexif-dev:amd64 (0.6.21-4), xsltproc:amd64 (1.1.29-5ubuntu0.2, automatic), intltool:amd64 (0.51.0-5ubuntu1), docbook:amd64 (4.5-6, automatic), python-mock:amd64 (2.0.0-3, automatic), python-pbr:amd64 (3.1.1-3ubuntu3, automatic), libcinnamon-desktop-dev:amd64 (4.4.1+tricia)
End-Date: 2020-01-07 06:45:14
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
I assume that will make any new pulled .url get the 'link to' prefix again?smurphos wrote: ⤴Wed Mar 11, 2020 2:20 am
You can delete the working folder we made (that's about 140 MiB) after installation.
Code: Select all
rm -f $HOME/nemo-dnd-mod
I was pretty much surprised to see the number 260mb passing when installing the build dependencies. Just to get rid of 6 characters. Didn't expect so much power had to be used for such a small correction.
Uninstalling the huge list is pretty much impossible.
Well in the end i didn't want the name change to get me some more diskspace.
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo
- Pepper-Mint-Patty
- Level 5
- Posts: 965
- Joined: Fri Dec 20, 2019 4:54 pm
- Location: Royston Vasey
Re: prefer clean filenames without: "link to"
Well it is a bit too late for that question now.
If guns don't kill, then OxyContin doesn't either, heroin isn't addicitve and fairy tales are real.
19.2 Cinn, Nemo
19.2 Cinn, Nemo