Last active
February 22, 2024 18:55
-
-
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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Big thanks for this :-)