Merge pull request #110017 from rhoriguchi/fuzzy-app-search

gnomeExtensions.fuzzy-app-search: init at 4
This commit is contained in:
Jan Tojnar 2021-02-13 15:23:35 +01:00 committed by GitHub
commit ff96a0fa56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,29 @@
{ lib, stdenv, fetchFromGitLab, gnome3, glib }:
stdenv.mkDerivation rec {
pname = "gnome-shell-extension-fuzzy-app-search";
version = "4";
src = fetchFromGitLab {
owner = "Czarlie";
repo = "gnome-fuzzy-app-search";
rev = "da9c15d39958d9c3b38df3b616fd40b85aed24e5";
sha256 = "1r3qha530s97x818znn1wi76f4x9bhlgi7jlxfwjnrwys62cv5fn";
};
uuid = "gnome-fuzzy-app-search@gnome-shell-extensions.Czarlie.gitlab.com";
nativeBuildInputs = [ glib ];
patches = [ ./fix-desktop-file-paths.patch ];
makeFlags = [ "INSTALL_PATH=$(out)/share/gnome-shell/extensions" ];
meta = with lib; {
description = "Fuzzy application search results for Gnome Search";
license = licenses.gpl3Only;
maintainers = with maintainers; [ rhoriguchi ];
homepage = "https://gitlab.com/Czarlie/gnome-fuzzy-app-search";
broken = versionOlder gnome3.gnome-shell.version "3.18";
};
}

View File

@ -0,0 +1,50 @@
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 = {};

View File

@ -27437,6 +27437,7 @@ in
easyScreenCast = callPackage ../desktops/gnome-3/extensions/EasyScreenCast { };
emoji-selector = callPackage ../desktops/gnome-3/extensions/emoji-selector { };
freon = callPackage ../desktops/gnome-3/extensions/freon { };
fuzzy-app-search = callPackage ../desktops/gnome-3/extensions/fuzzy-app-search { };
gsconnect = callPackage ../desktops/gnome-3/extensions/gsconnect { };
icon-hider = callPackage ../desktops/gnome-3/extensions/icon-hider { };
impatience = callPackage ../desktops/gnome-3/extensions/impatience { };