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.

1
  • 7
    I can't imagine what is motivation to remove very popular hotkey from app for everyday use.
    – ruX
    Jan 25, 2014 at 9:52

9 Answers 9

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
16
  • 2
    Does it work for you? ; (gtk_accel_path "<Actions>/ShellActions/Up" "BackSpace") For me, its not working. May 2, 2013 at 13:00
  • 7
    Please remove the comment. this one -> ; use only (gtk_accel_path "<Actions>/ShellActions/Up" "BackSpace")
    – Achu
    May 2, 2013 at 13:15
  • 2
    Aaah... How could I miss that. Spent two hours this morning. I didnt uncomment. :( Thanks @Achu :) May 2, 2013 at 13:17
  • 3
    Thanks. Since it is not possible to "bind" both Backspace and Alt+Up to the same (I'm actually quite used to the Alt+Down/Up instead of Enter/Backspace when using only the keyboard), but as a workaround you can also change Backspace to do "<Actions>/ShellActions/Back". May 24, 2013 at 0:43
  • 2
    Aaaaaaah!! its working! sigh of relief! :D thanx a lot
    – Nirmik
    Jun 6, 2013 at 9:42
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

0
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.

6
  • Still gice the following error: ("syntax error near unexpected token `gtk_accel_path'"
    – Tareq
    May 6, 2013 at 6:43
  • @Tareq: Are you using Thunar or Nautilus? Ubuntu comes with Nautilus by default...
    – Lawand
    May 13, 2013 at 11:06
  • I am using Nautilus.
    – Tareq
    May 14, 2013 at 15:54
  • @Tareq: well, what I wrote is for Thunar... Did you try Achu's answer?: askubuntu.com/a/289540/815
    – Lawand
    May 14, 2013 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, 2013 at 9:27
5

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

echo '(gtk_accel_path "<Actions>/ShellActions/Back" "BackSpace")' >> ~/.config/nautilus/accels
2
  • Indeed this is the only one that worked for me.
    – Ruben
    Mar 26, 2014 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 3, 2015 at 13:40
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
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
1
  • @Jorge Castro: you may need to add <Actions> to the proposed command: echo ' (gtk_accel_path "<Actions>/ShellActions/Up" "BackSpace") >> ~/.config/nautilus/accels
    – alex
    Aug 3, 2016 at 10:39
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
1
  • 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, 2020 at 5:57
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
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

You must log in to answer this question.

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