Skip to content

Instantly share code, notes, and snippets.

@rammanokar
Last active April 19, 2022 14:44
Show Gist options
  • Save rammanokar/a4a00f76d99fd204d88c050e21494eed to your computer and use it in GitHub Desktop.
Save rammanokar/a4a00f76d99fd204d88c050e21494eed to your computer and use it in GitHub Desktop.
nautilus extension to copy current folder path to clipboard

nautilus-CopyPath

Tux

Prerequisites:

Install python-nautilus and wl-clipboard sudo pacman -S python-nautilus wl-clipbard

This script is tested on wayland session.

Installtion

copy the below file to ~/.local/share/nautilus-python/extensions

import subprocess
from gi.repository import Nautilus, GObject
class ColumnExtension(GObject.GObject, Nautilus.MenuProvider):
def __init__(self):
pass
def menu_activate_cb(self, menu, file):
try:
subprocess.run(["wl-copy", file.get_uri().replace("file://", "")])
except:
print("error in copying")
def get_background_items(self, window, file):
item = Nautilus.MenuItem(
name="ExampleMenuProvider::FileCopy", label="Copy Path", tip="", icon=""
)
item.connect("activate", self.menu_activate_cb, file)
return (item,)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment