71

I want to use the "BackSpace" button as a shortcut key on nautilus. I want to return to the previous folder whilst browsing the Home folder, just like windows 7.

Also I want the same thing while using Firefox, In a way that when I press the shortcut key I will return to the previous web page.

Braiam
  • 67,791
  • 32
  • 179
  • 269
Tareq
  • 811
  • 1
  • 7
  • 4
  • 7
    I can't imagine what is motivation to remove very popular hotkey from app for everyday use. – ruX Jan 25 '14 at 09:52

9 Answers9

77

For Firefox and Nautilus: You can use Alt+ to go back instead of Backspace.

For nautilus 3.6 to bring backspace functionality you need to add this:

 (gtk_accel_path "<Actions>/ShellActions/Up" "BackSpace")

under

~/.config/nautilus/accels

And then restart nautilus by

nautilus -q or killall nautilus

In Thunar you have to add

(gtk_accel_path "<Actions>/ThunarWindow/open-parent" "BackSpace")

to

~/.config/Thunar/accels.scm
Alex
  • 1,052
Achu
  • 21,237
6

For Firefox

Open firefox, type in about:config in address bar, press enter

Search backspace, should return 1 entry, browser.backspace_action

Right click on the value > modify & change from 2 to 0

doug
  • 17,026
5

2020 - For Nautilus 3.30.5 (on Debian Buster and Gnome 3.30.2)

Based on nautilus-backspace, you need to install nautilus-python and then place a python script in ~/.local/share/nautilus-python/extensions/.

Install python-nautilus using this:

sudo apt-get install python-nautilus

You may need to create the directory as well.

mkdir -p ~/.local/share/nautilus-python/extensions

Now, navigate to the newly created directory:

cd ~/.local/share/nautilus-python/extensions

Download the script:

wget https://raw.githubusercontent.com/riclc/nautilus_backspace/master/BackspaceBack.py

Finally, restart Nautilus using:

killall nautilus
nsssayom
  • 191
5

for thunar

Just as I thought, I should have written backspace in a different way. This is how I tried:

(gtk_accel_path "<Actions>/ThunarWindow/open-parent" "BackSpace")

And it worked.

fossfreedom
  • 172,746
Lawand
  • 141
  • Still gice the following error: ("syntax error near unexpected token `gtk_accel_path'" – Tareq May 06 '13 at 06:43
  • @Tareq: Are you using Thunar or Nautilus? Ubuntu comes with Nautilus by default... – Lawand May 13 '13 at 11:06
  • I am using Nautilus. – Tareq May 14 '13 at 15:54
  • @Tareq: well, what I wrote is for Thunar... Did you try Achu's answer?: http://askubuntu.com/a/289540/815 – Lawand May 14 '13 at 20:15
  • Yes, But it didn't work, I don't know how to make the addition, or how to write on the Read-Only file (accels). – Tareq May 17 '13 at 09:27
  • maybe you need root access? for example, if you are using gedit to modify the text file, then press alt+f2 and type "gksudo gedit" then open the file and edit it. – Lawand May 25 '13 at 14:00
5

Is not "up" is "back", back is the last directory.

echo '(gtk_accel_path "<Actions>/ShellActions/Back" "BackSpace")' >> ~/.config/nautilus/accels
fpilee
  • 320
  • Indeed this is the only one that worked for me. – Ruben Mar 26 '14 at 23:19
  • Correct - this is proper one for "back', up is parent directory not back. Also note that at least in nautius 3.10 (14.04, trusty) backspace is auto binded to up so one would need to manually edit the file. – doug Jul 03 '15 at 13:40
2

2019 - For Nautilus:
Based on @riclc/nautilus_backspace repo, I wrote a shell script to install the necessary packages and scripts to bring back this function. I use it with Fedora 30, but the script would work for distros that using apt and pacman too.

wget -qO- https://raw.githubusercontent.com/7aman/backspace-up/master/install.sh | bash
Zaman
  • 76
  • 1
    I tried manually adding the function in accels file and didn't work, I reviewed the code of this before run, saw nothing nasty, and IT WORKED. Thx, you saved me time. – m3nda Jan 23 '20 at 05:57
2

To make Nautilus go back like in old times, with the Backspace key, do this:

echo '(gtk_accel_path "/ShellActions/Up" "BackSpace")' >> ~/.config/nautilus/accels
Jorge Castro
  • 71,754
  • @Jorge Castro: you may need to add to the proposed command: echo ' (gtk_accel_path "<Actions>/ShellActions/Up" "BackSpace") >> ~/.config/nautilus/accels – alex Aug 03 '16 at 10:39
1

For Debian 11 (based on above information):

sudo apt install python3-nautilus

mkdir -p ~/.local/share/nautilus-python/extensions cd ~/.local/share/nautilus-python/extensions

wget https://raw.githubusercontent.com/riclc/nautilus_backspace/master/BackspaceBack.py

Open the downloaded script for editing:

gedit BackspaceBack.py

Change lines in the downloaded script as below:

"#!/usr/bin/env python"
->
"#!/usr/bin/env python3"

"app.set_accels_for_action( "win.up", ["BackSpace"] )" -> "app.set_accels_for_action( "win.back", ["BackSpace"] )"

Kill and then start manually:

killall nautilus
nvd
  • 1,160
  • 9
  • 7
1

For Thunar:

This problem has haunted me since the gtk_accel_path method stopped working around Ubuntu version 21.10. I'm running thunar version 4.16.10. I think I have a solution using autokey-gtk:

Install autokey

sudo apt install autokey-gtk

Open the AutoKey application, click New, then Script, and then I named it backspace_for_parent (your choice). Replace # Enter script code with the following:

win_class = window.get_active_class()
win_title = window.get_active_title()
if win_class == 'Thunar.Thunar' and win_title.startswith("/"):
  keyboard.send_keys("<alt>+<up>")
else:
  keyboard.send_keys("<backspace>")

(The second startswith condition above was needed to allow normal backspace when renaming files or setting the name of a new folder.)

Then, below, for Hotkey, click Set. Click Press to Set and hit backspace and then click OK.

Finally, at the top, click Save.

Now, in Thunar, hitting the backspace key opens the parent folder!

This is slightly suboptimal in that it uses an external application, but AutoKey is fantastic and it's already part of my daily workflow, so nbd from my perspective.

Hope this helps someone.

Inspiration taken from:
https://unix.stackexchange.com/a/491868/126708