-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGFicon.py
27 lines (25 loc) · 937 Bytes
/
GFicon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python
import subprocess
import os
# By: mohamedation
# mohamedation.com
# License: GPL-3.0-or-later
# GFicon: Gnome Folder icon is a python script that looks for
# folders in the current working directory, and set their
# icons using a png image if it is inside the respective folder
# and named ".folder.png"
dr = os.getcwd()
for root, dirs, files in os.walk(dr):
for directory in dirs:
folder = os.path.join(root, directory)
if os.path.isfile(folder+"/.folder.png"):
try:
first = folder+"/.folder.png"
except ValueError:
pass
else:
subprocess.Popen([
"gio", "set", "-t", "string",
os.path.abspath(folder), "metadata::custom-icon",
"file://"+os.path.abspath(os.path.join(folder, first))
])