Install python-nautilus and wl-clipboard
sudo pacman -S python-nautilus wl-clipbard
This script is tested on wayland session.
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,) |