72

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
  • 69,112
Tareq
  • 821

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,062
Achu
  • 21,407
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,212
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
  • 174,526
Lawand
  • 141
5

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

echo '(gtk_accel_path "<Actions>/ShellActions/Back" "BackSpace")' >> ~/.config/nautilus/accels
fpilee
  • 330
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
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
  • 73,717
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,250
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