Beginnings of a tagfarm plugin for Nautilus.
Chris Pressey
1 year, 30 days ago
0 | # | |
1 | # tagfarm plugin for Nautilus. | |
2 | # | |
3 | # to install: | |
4 | # | |
5 | # sudo apt-get install python3-nautilus | |
6 | # mkdir -p ~/.local/share/nautilus-python/extensions/ | |
7 | # ln -s `realpath script/tagfarm_nautilus.py` ~/.local/share/nautilus-python/extensions/tagfarm_nautilus.py | |
8 | # nautilus -q && nautilus & | |
9 | # | |
10 | ||
11 | import os | |
12 | import subprocess | |
13 | from urllib.parse import unquote | |
14 | from gi.repository import Nautilus, GObject | |
15 | ||
16 | ||
17 | class OpenTerminalExtension(Nautilus.MenuProvider, GObject.GObject): | |
18 | ||
19 | def __init__(self): | |
20 | pass | |
21 | ||
22 | def get_file_items(self, window, files): | |
23 | if not files: | |
24 | return | |
25 | ||
26 | item = Nautilus.MenuItem( | |
27 | name="NautilusPython::showtags_file_item", | |
28 | label="Show Tags", | |
29 | tip="Show Tags for Selected Files" | |
30 | ) | |
31 | ||
32 | item.connect('activate', self._show_tags, files) | |
33 | return item, | |
34 | ||
35 | def _show_tags(self, menu, files): | |
36 | for file in files: | |
37 | filename = unquote(file.get_uri()[7:]) | |
38 | subprocess.run(["tagfarm", "showtags", filename]) |