Giter Site home page Giter Site logo

Comments (16)

nakamuray avatar nakamuray commented on June 2, 2024

Is 5e1e363 fix this issue?

from zaw.

junkblocker avatar junkblocker commented on June 2, 2024

At least, I love it because I wrote it :) @sorin-ionescu 's idea of 'kMDItemKind == "Application"' would be

  1. a more accurate and thorough way determining applications
  2. extremely slow taking minutes at least on my host to return the results (and subsequent runs don't seem to get much faster either)
  3. dependent on Spotlight indexing being enabled

Given those at least I prefer what I implemented. However, I also have 'locate' installed and running and getting candidates via "locate -i .app | grep '.app$'" for this is probably a better alternate implementation that I might end up implementing sometime.

from zaw.

sorin-ionescu avatar sorin-ionescu commented on June 2, 2024

Depending on Spotlight is a better implementation. Who disables Spotlight indexing? Anybody? It's a non-issue.

from zaw.

junkblocker avatar junkblocker commented on June 2, 2024

Quick googling for spotlight indexing "disable" should convince you otherwise. Initial releases on Mountain Lion and IIRC evan Lion had a lot of slow, repetitive, high cpu indexing issues.

Even ignoring that slow execution of the spotlight query still would remain the bigger issue.

A solution with selective enabling/disabling of these implementation (mdfind, locate, glob) would be the way I'd go about it. That way everybody could be happy. Heck we could just create a separate source altogether.

from zaw.

junkblocker avatar junkblocker commented on June 2, 2024

@sorin-ionescu : You can try out the junkblocker@dfdea54 which implements your suggestion with

export ZAW_SRC_APPLICATIONS_USE_MDFIND=1

to see how well it does or does not work.

@nakamuray It would be good to to have a zstyles facility for source specific settings to avoid such environment variables. Please let me know your thoughts and/or if you want me to file an issue for that.

from zaw.

sorin-ionescu avatar sorin-ionescu commented on June 2, 2024

While there have been Spotlight bugs, said bugs were fixed.

Environment variables should not be needed since zaw works in the same Zsh process, does not it?

from zaw.

junkblocker avatar junkblocker commented on June 2, 2024

Yes, but still mdfind query slowness point is the problem. It takes minutes for the query to come back.

And yes, you are correct about not needing to export it.

from zaw.

sorin-ionescu avatar sorin-ionescu commented on June 2, 2024

time mdfind 'kMDItemKind == "Application"'

0.02s user 0.02s system 60% cpu 0.066 total

from zaw.

junkblocker avatar junkblocker commented on June 2, 2024

I am getting these sorts of numbers instead from two different Macbook Pros one 3 years old and another 6 months old both running Mountain Lion latest with 8G ram.

mdfind 'kMDItemKind == "Application"'
0.03s user 0.09s system 0% cpu 4:43.44 total

However now knowing how long it should take, I figured out what is happening. I have a local encrypted dmg ~/something.dmg mounted as a volume at /Volumes/something which is being indexed too (on both laptops). If I unmount the volume, the times start matching yours. Spotlight is likely not indexing the mounted volumes but doing a find in it instead or actively updating the index from it (the content in it changes a lot).

So, changing the query to search on / only works:

time mdfind -onlyin / 'kMDItemKind == "Application"'
0.01s user 0.01s system 23% cpu 0.098 total

and I am fine with not getting results from mounted volumes, local or remote. I'd still leave globbing as a fallback in case mdfind returned nothing as in the implementation I pointed you at. I'll make it default and propose this if it is ok with you.

from zaw.

sorin-ionescu avatar sorin-ionescu commented on June 2, 2024

-onlyin / is good enough.

from zaw.

junkblocker avatar junkblocker commented on June 2, 2024

Sent pull request with slight change of using all of the available sources for completeness sake as mdfind is not listing apps inside apps. See proposed commits for comments.

from zaw.

sorin-ionescu avatar sorin-ionescu commented on June 2, 2024

I don't think it should list apps inside apps. I don't see where you would ever want to run an app inside an app. Those apps are dependencies of the main app.

from zaw.

junkblocker avatar junkblocker commented on June 2, 2024

Hmm, I am kinda split on this. I was able to just launch a couple of useful sub apps using this, however yeah most of these internal apps do seem not to be usable directly. I'd still like to keep the feature though. Any suggestions? Maybe hide it behind an environment variable? Wishing for zstyle for sources very strongly right about now.

from zaw.

junkblocker avatar junkblocker commented on June 2, 2024

Ok, made locate use optional since it is taking about 5 seconds with it and also by default turned off internal apps. junkblocker@0363cd2 .

from zaw.

nakamuray avatar nakamuray commented on June 2, 2024

#23 was merged. Can I close this issue?

from zaw.

sorin-ionescu avatar sorin-ionescu commented on June 2, 2024

Yeah, it should be closed.

from zaw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.