diff --git a/src/getavailablethemes.py b/src/getavailablethemes.py index 0504062..f3ba9eb 100644 --- a/src/getavailablethemes.py +++ b/src/getavailablethemes.py @@ -15,6 +15,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import os +from pathlib import Path from gi.repository import Gtk, GLib, GdkPixbuf from .pixbuffromxcursor import pixbufFromXCursor @@ -38,8 +39,7 @@ def getAvailableGtk3Themes(): lookupPaths = [ os.path.join(GLib.get_user_data_dir(), "themes"), os.path.join(GLib.get_home_dir(), ".themes"), - "/usr/share/themes" - ] + ] + [os.path.join(dataDir, "themes") for dataDir in GLib.get_system_data_dirs()] for lookupPath in lookupPaths: try: for f in os.listdir(lookupPath): @@ -63,8 +63,7 @@ def getAvailableIconThemes(): lookupPaths = [ os.path.join(GLib.get_user_data_dir(), "icons"), os.path.join(GLib.get_home_dir(), ".icons"), - "/usr/share/icons" - ] + ] + [os.path.join(dataDir, "icons") for dataDir in GLib.get_system_data_dirs()] for lookupPath in lookupPaths: try: for f in os.listdir(lookupPath): @@ -102,8 +101,7 @@ def getAvailableCursorThemes(): lookupPaths = [ os.path.join(GLib.get_user_data_dir(), "icons"), os.path.join(GLib.get_home_dir(), ".icons"), - "/usr/share/icons" - ] + ] + [os.path.join(dataDir, "icons") for dataDir in GLib.get_system_data_dirs()] for lookupPath in lookupPaths: try: for f in os.listdir(lookupPath): @@ -135,8 +133,7 @@ def getAvailableGtk4Themes(): lookupPaths = [ os.path.join(GLib.get_user_data_dir(), "themes"), os.path.join(GLib.get_home_dir(), ".themes"), - "/usr/share/themes" - ] + ] + [os.path.join(dataDir, "themes") for dataDir in GLib.get_system_data_dirs()] for lookupPath in lookupPaths: try: for f in os.listdir(lookupPath): @@ -152,8 +149,7 @@ def getAvailableGtk2Themes(): lookupPaths = [ os.path.join(GLib.get_user_data_dir(), "themes"), os.path.join(GLib.get_home_dir(), ".themes"), - "/usr/share/themes" - ] + ] + [os.path.join(dataDir, "themes") for dataDir in GLib.get_system_data_dirs()] for lookupPath in lookupPaths: try: for f in os.listdir(lookupPath): @@ -163,13 +159,13 @@ def getAvailableGtk2Themes(): pass return uniquifySortedListStore(availableThemes) -def getAvailableKvantumThemes(): +def getAvailableKvantumThemes(kvantumPath): availableThemes = Gtk.ListStore(str, str) availableThemes.set_sort_column_id(0, Gtk.SortType.ASCENDING) availableThemes.append(["Kvantum", "default"]) lookupPaths = [ os.path.join(GLib.get_user_config_dir(), "Kvantum"), - "/usr/share/Kvantum" + os.path.join(Path(kvantumPath).parent.parent, "share", "Kvantum") ] for lookupPath in lookupPaths: try: @@ -180,4 +176,4 @@ def getAvailableKvantumThemes(): availableThemes.append([f+"Dark", f+"Dark"]) except: pass - return uniquifySortedListStore(availableThemes) \ No newline at end of file + return uniquifySortedListStore(availableThemes) diff --git a/src/meson.build b/src/meson.build index 3bb98b4..8d5dc46 100644 --- a/src/meson.build +++ b/src/meson.build @@ -18,7 +18,7 @@ conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir'))) conf.set('pkgdatadir', pkgdatadir) conf.set('gtkversion', '3.0') -pythondep = python.dependency(version: '>= 3.5') +pythondep = python.dependency(version: '>= 3.6') pygobjectdep = dependency('pygobject-3.0') xcursordep = dependency('xcursor') gdkpixbufdep = dependency('gdk-pixbuf-2.0') diff --git a/src/window.py b/src/window.py index 5fd971c..04dc3d8 100644 --- a/src/window.py +++ b/src/window.py @@ -177,7 +177,8 @@ def __init__(self, app): self.anotherGtk4ThemeSwitch.set_active(hasAnotherGtk4Theme) self.gtk4SearchableThemeList.set_visible(hasAnotherGtk4Theme) - if shutil.which("kvantummanager"): + kvantumPath = shutil.which("kvantummanager") + if kvantumPath: try: kvantumKeyFile = GLib.KeyFile() kvantumKeyFile.load_from_file(os.path.join(GLib.get_user_config_dir(), "Kvantum", "kvantum.kvconfig"), GLib.KeyFileFlags.NONE) @@ -186,7 +187,7 @@ def __init__(self, app): self.kvantumThemeName = self.gtkProps.gtk_theme_name hasAnotherKvantumTheme = self.gtkProps.gtk_theme_name != self.kvantumThemeName self.kvantumSearchableThemeList = SearchableThemeList( - getAvailableKvantumThemes(), + getAvailableKvantumThemes(kvantumPath), self.kvantumThemeName, self.onKvantumThemeChanged )