The following code works:
#!/usr/bin/gjs
const res = imports.gi.GIRepository.Repository
// load library of Mutter project
res.prepend_search_path('/usr/lib/x86_64-linux-gnu/mutter-11')
res.prepend_library_path('/usr/lib/x86_64-linux-gnu/mutter-11')
// load library of gnome-shell project
res.prepend_search_path('/usr/lib/gnome-shell')
res.prepend_library_path('/usr/lib/gnome-shell')
const Shell = imports.gi.Shell;
const appSys = Shell.AppSystem.get_default();
print(appSys.get_installed().map(x => x.get_name()).join('\n'));
However, if I replace get_installed
with get_running
, then there are no output. Why?