Last active
October 31, 2025 05:25
-
-
Save molaeiali/3f99f9c8b8b845b803bbdbb1fcbb4cbf to your computer and use it in GitHub Desktop.
Adds ability to go up a directory by pressing Backspace button in nautilus. This will work with the new Nautilus 43/Gnome 43/Gtk4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Nautilus Backspace Back Extension | |
| # | |
| # Place me in ~/.local/share/nautilus-python/extensions/, | |
| # ensure you have python-nautilus package, restrart Nautilus, and enjoy :) | |
| # | |
| # This script was written by molaeiali and is released to the public domain | |
| import os, gi | |
| gi.require_version('Nautilus', '4.0') | |
| from gi.repository import GObject, Nautilus, Gtk, Gio, GLib | |
| def back(): | |
| app = Gtk.Application.get_default() | |
| if not app.get_actions_for_accel("BackSpace"): | |
| app.set_accels_for_action( "win.up", ["BackSpace"] ) | |
| class BackspaceBack(GObject.GObject, Nautilus.InfoProvider): | |
| def __init__(self): | |
| pass | |
| def update_file_info(self, file): | |
| back() | |
| return None |
Big thanks Brother
Hi bro, i've using this for long, there is an update now in gnome 48
app.set_accels_for_action( "win.up", ["BackSpace"] ) from this code update slot.up instead of win-up
@molaeiali Thanks for sharing your script!
Here’s the updated version that’s compatible with both GNOME 48 and GNOME 49.
#!/usr/bin/env python
import gi
gi.require_version('Gtk', '4.0')
from gi.repository import GObject, Nautilus, Gtk
class BackspaceBack(GObject.GObject, Nautilus.MenuProvider):
def __init__(self):
super().__init__()
def get_file_items(self, *args):
app = Gtk.Application.get_default()
if not app.get_actions_for_accel("BackSpace"):
app.set_accels_for_action("slot.back", ["BackSpace"])
return None
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Big thanks for this :-)