Skip to content

Instantly share code, notes, and snippets.

@molaeiali
Last active February 22, 2024 18:55
Show Gist options
  • Save molaeiali/3f99f9c8b8b845b803bbdbb1fcbb4cbf to your computer and use it in GitHub Desktop.
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
# 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
@alescdb
Copy link

alescdb commented Nov 17, 2022

Big thanks for this :-)

@rizqikazukun
Copy link

Big thanks Brother

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment