()
| 3 | |
| 4 | export class AppsManager { |
| 5 | static getApps() { |
| 6 | const usage = Shell.AppUsage.get_default(); |
| 7 | const appSystem = Shell.AppSystem.get_default(); |
| 8 | const appsInstalled = appSystem.get_installed().filter((appInfo) => { |
| 9 | try { |
| 10 | const _ = appInfo.get_id(); // catch invalid file encodings |
| 11 | } catch (e) { |
| 12 | return false; |
| 13 | } |
| 14 | return appInfo.should_show(); |
| 15 | }); |
| 16 | |
| 17 | return appsInstalled |
| 18 | .sort((a, b) => { |
| 19 | return usage.compare(a.get_id(), b.get_id()); |
| 20 | }) |
| 21 | .map((appInfo) => { |
| 22 | return appSystem.lookup_app(appInfo.get_id()); |
| 23 | }); |
| 24 | } |
| 25 | } |
no test coverage detected