As gnome-shell is moving to ESM, it will now load extensions as standard modules instead of using legacy imports. The change boils down to exporting the Extension class as default, but we can also start using standard imports for introspected modules now, so do that at the same time. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/259>
23 lines
579 B
JavaScript
23 lines
579 B
JavaScript
import GLib from 'gi://GLib';
|
|
|
|
const fn = (...args) => GLib.build_filenamev(args);
|
|
|
|
/**
|
|
* @returns {string[]} - an ordered list of theme directories
|
|
*/
|
|
export function getThemeDirs() {
|
|
return [
|
|
fn(GLib.get_home_dir(), '.themes'),
|
|
fn(GLib.get_user_data_dir(), 'themes'),
|
|
...GLib.get_system_data_dirs().map(dir => fn(dir, 'themes')),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @returns {string[]} - an ordered list of mode theme directories
|
|
*/
|
|
export function getModeThemeDirs() {
|
|
return GLib.get_system_data_dirs()
|
|
.map(dir => fn(dir, 'gnome-shell', 'theme'));
|
|
}
|