8

As an re-education procedure in order to reduce (likely) future data loss, I wish to disable the Shift+Del functionality to delete files in Ubuntu (11.10 and 12.04). Also, if I could replace it with a "Stop that!" popup alert, even better.

I know there are data recovery tools for such cases, but better never put my important data at risk due to such mistakes. And I found nothing similar around, so I hope someone here can show me how, if possible.

4 Answers 4

8

If you define a shortcut on window manager's level, it won't go to Nautilus. Combined with Zenity, you can even show yourself an alert.

First make sure Zenity is installed

sudo apt-get install zenity

Now go to System Settings (or run gnome-control-center) → KeyboardShortcuts tab, select Custom shortcuts (last item in the left menu), click + to create new shortcut. Call it however you want, and set this command:

zenity --error --text='Stop doing that!'

Once you add the shortcut, assign Shift+Delete to it. Now every time you press Shift+Delete, you get a warning box. Unfortunately this means you can't use this shortcut within any application, but it's rather quick workaround to get rid of a habit.

7
  • It worked wonderfully. Better this way, as I can't work around it, I'll just learn to use regular Delete. Many thanks, jnv!
    – mdrg
    May 13, 2012 at 0:32
  • Now I understand what you meant by 'within any application'. The alert sometimes pop up on text editors while shift-selecting text and deleting it in rapid succession. A small quirk, but this is not a real shortcut on any application so far, so no big deal.
    – mdrg
    May 17, 2012 at 19:48
  • I clicked on + and created custom shortcut, but I am not able to assigh Shift+Delete to it. BTW, I am using 12.04. Jun 8, 2012 at 6:33
  • @PraveenSripati Once the shortcut is created, double click Disabled in the right column, it will change to New shortcut…, then press Shift+Del. If you can't assign this one particular shortcut, it's possible the shortcut is already handled by Compiz. Or maybe it's not assignable in Precise; I am still on Oneiric so I can't test this.
    – jnv
    Jun 10, 2012 at 0:29
  • 1
    Thanks a lot for this tip, jnv. From now on, I won't accidentally delete my files for good anymore. :)
    – brunces
    Jun 29, 2013 at 0:25
1

You can generally prevent the files from being deleted either by Shift + Del or the normal deletion by adjusting the permission of the directories to read-only for users. Set it in a way that administrators can only modify any content.

0

An easier solution in Ubuntu 20.04 is to go to Settings → DevicesKeyboard and adding a new shortcut Shift+Delete with no command in it.

1
  • In Ubuntu 20.04 the path is Setiings → Keyboard Shortcuts, not Settings → DevicesKeyboard. Also, you cannot add a shortcut without a command, but you can add gibberish as a command (like "blablabla") and your suggestion would work. You may edit your answer to improve it based on this comment, if you wish. If you do that please ping me in a comment (using @BeastOfCaerbannog) and I will gladly upvote it, since it's a nice suggestion! Nov 27, 2020 at 19:13
0

To build off the answer from sorrow-poetry:

You can set the command to : to ensure that SHIFT + DEL does nothing.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .