mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 00:22:13 +00:00
50 lines
1.6 KiB
Diff
Executable file
50 lines
1.6 KiB
Diff
Executable file
diff --git a/applicationsUtils.js b/applicationsUtils.js
|
|
index 728223b..aa9f291 100644
|
|
--- a/applicationsUtils.js
|
|
+++ b/applicationsUtils.js
|
|
@@ -44,27 +44,24 @@ var Search = new Lang.Class({
|
|
* @return {Void}
|
|
*/
|
|
_init: function () {
|
|
- let dir = [
|
|
- "/usr/share/applications",
|
|
- GLib.get_home_dir() + "/.local/share/applications",
|
|
- ];
|
|
-
|
|
- // listen object - file/monitor list
|
|
- this._listen = dir.map((path) => {
|
|
- let file = Gio.File.new_for_path(path);
|
|
- let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
|
|
-
|
|
- // refresh on each directory change
|
|
- monitor.connect(
|
|
- "changed",
|
|
- Lang.bind(this, this._handleMonitorChanged)
|
|
- );
|
|
-
|
|
- return {
|
|
- file: file,
|
|
- monitor: monitor,
|
|
- };
|
|
- });
|
|
+ this._listen = [...new Set(GLib.get_system_data_dirs())]
|
|
+ .filter((path) => path.endsWith("/share"))
|
|
+ .map((path) => Gio.File.new_for_path(path + "/applications"))
|
|
+ .filter((file) => file.query_exists(null))
|
|
+ .map((file) => {
|
|
+ let monitor = file.monitor(Gio.FileMonitorFlags.NONE, null);
|
|
+
|
|
+ // refresh on each directory change
|
|
+ monitor.connect(
|
|
+ "changed",
|
|
+ Lang.bind(this, this._handleMonitorChanged)
|
|
+ );
|
|
+
|
|
+ return {
|
|
+ file: file,
|
|
+ monitor: monitor,
|
|
+ };
|
|
+ });
|
|
this._interval = null;
|
|
this._data = {};
|
|
|