Skip to content

Commit 0fc32e2

Browse files
authored
fix: Actually use XDG_DATA_HOME to store themes and icons instead of home (#11175)
Mainly to not clutter up the user home folder Changes: * Change themes install dir to `XDG_DATA_HOME` * when we initialize the `Spice_Harvester` we only ensure (create) the `install_folder` not the other directories Checked that themes still load from old location
1 parent dd334a6 commit 0fc32e2

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ def __init__(self, collection_type, window=None):
159159
self.enabled_key = 'enabled-%ss' % self.collection_type
160160

161161
if self.themes:
162-
self.install_folder = '%s/.themes/' % (home)
163-
self.spices_directories = (self.install_folder, )
162+
self.install_folder = os.path.join(GLib.get_user_data_dir(), 'themes')
163+
old_install_folder = '%s/.themes/' % (home)
164+
self.spices_directories = (self.install_folder, old_install_folder)
164165
else:
165166
self.install_folder = '%s/.local/share/cinnamon/%ss/' % (home, self.collection_type)
166167
self.spices_directories = ('/usr/share/cinnamon/%ss/' % self.collection_type, self.install_folder)
@@ -423,9 +424,11 @@ def _load_metadata(self):
423424
if not self.themes:
424425
print(detail)
425426
print("Skipping %s: there was a problem trying to read metadata.json" % uuid)
426-
else:
427+
elif(directory == self.install_folder):
427428
print("%s does not exist! Creating it now." % directory)
428429
subprocess.call(["mkdir", "-p", directory])
430+
else:
431+
print("%s does not exist! Skipping" % directory)
429432

430433
def _directory_changed(self, *args):
431434
self._load_metadata()

files/usr/share/cinnamon/cinnamon-settings/modules/cs_themes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,14 @@ def on_module_selected(self):
141141

142142
self.builder = self.sidePage.builder
143143

144-
for path in [os.path.expanduser("~/.themes"), os.path.expanduser("~/.icons")]:
144+
for path in [THEME_FOLDERS[0], ICON_FOLDERS[0]]:
145145
try:
146146
os.makedirs(path)
147147
except OSError:
148148
pass
149149

150150
self.monitors = []
151-
for path in [os.path.expanduser("~/.themes"), "/usr/share/themes", os.path.expanduser("~/.icons"), "/usr/share/icons"]:
151+
for path in (THEME_FOLDERS + ICON_FOLDERS):
152152
if os.path.exists(path):
153153
file_obj = Gio.File.new_for_path(path)
154154
try:
@@ -470,7 +470,7 @@ def _load_cinnamon_themes(self):
470470
return res
471471

472472
def update_cursor_theme_link(self, path, name):
473-
default_dir = os.path.join(os.path.expanduser("~"), ".icons", "default")
473+
default_dir = os.path.join(ICON_FOLDERS[0], "default")
474474
index_path = os.path.join(default_dir, "index.theme")
475475

476476
try:

0 commit comments

Comments
 (0)