Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

From the new Nautilus releases exist the ability to create shortcut/bookmarks simply by drag&drop folder onto the nautilus left panel;

However, this behavior can unintentionally create additional bookmarks if you are not very accurate when dragging files to bookmarks, especially by people with little experience in the use of computer.

How is possible to disable the drag&drop bookmarks creation?

Or ideally should be planning to implement the drag & drop mode only if you are running in conjunction with the press of a key on the keyboard ..

share|improve this question

1 Answer 1

Simple solution

The bookmarks that you mention are stored in `~/.config/gtk-3.0/bookmarks. The simpelest solution is to write-protect the file by the command:

chmod 464 ~/.config/gtk-3.0/bookmarks

to set it back to default:

chmod 664 ~/.config/gtk-3.0/bookmarks

To switch between the two, you can set two different key combinations (on/off) for these commands in System Settings > Keyboard > Shortcuts > Custom Shortcuts. In that case you have to use the full path to the file, e.g. chmod 464 /home/jacob/.config/gtk-3.0/bookmarks

In this case, if you drag a folder over the bookmarks in the left pane, it will appear at first, but it won't stick after you close the window.

Alternative

if for some reason, you would not like to change the permissions of the file, you can run the script below in the background:

#!/usr/bin/env python3

import os
import time

home = os.getenv("HOME")
file = home+"/.config/gtk-3.0/bookmarks"

with open(file, "r") as current:
    bookmarks = current.readlines()

def fix_bookmarks():
    time1 = os.path.getmtime(file)
    while 1 != 0:
        time2 = os.path.getmtime(file)
        if time2 == time1:
            pass
        else:
            with open(file, "wt") as current:
                for line in bookmarks:
                    current.write(line)
            time2 = os.path.getmtime(file)
            time1 = time2
        time.sleep(5)

fix_bookmarks()

Copy the script into an empty file, save it as fix_bookmarks.py, make it executable and run it bu the command

/path/to/fix_bookmarks.py

You could add the script to your startup applications (Dash > Startup Applications > Add)

What it does

It checks the modification time of the file ~/.config/gtk-3.0/bookmarks every 5 seconds. If it differs from the last check, changes are reverted visibly within 5 seconds (or any other time you set in time.sleep(5)).

share|improve this answer
    
Hi Jacob Vlijm, your suggestions are both very useful for me, but my intention was to make much simpler the drag & drop copy/transfer action for people not accustomed to the use of computer. Infact the big problem is that for some people to drag the file to bookmarks likely to cause confusion when the bookmarks changes state, and adjusts itself to the addition of the bookmark instead of copying/transferring the file. The ideal in my opinion should be to switch back to gnome 3.2 modality, where the bookmarks was added only via menu. What do you think, could it be possible? Thanks! –  Davide Marchi Aug 20 at 16:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.