project-gauntlet / gauntlet

Raycast-inspired open-source cross-platform application launcher with React-based plugins
Mozilla Public License 2.0
146 stars 4 forks source link

No Applications shown on MacOS 15 #21

Open diogox opened 2 days ago

diogox commented 2 days ago

This is actually the first thing I noticed after opening up Gauntlet, but I wanted to provide some useful debugging info before reporting it.

CleanShot 2024-10-05 at 11 36 55@2x

Haven't been able to do that yet, so figured I'd raise the issue in case the mistake is easy to spot, and to answer any questions you may have to help debug 🙌

I will point out, I have a rather different MacOS setup that uses nix-darwin and home-manager, but all applications are installed through Brew module so that shouldn't be the issue.

Exidex commented 2 days ago

So the issue is that when first opening the app it needs to index all existing applications and most importantly to create small icons to make it usable in the app and it takes some time. I haven't done an optimization pass on it yet to make it faster. The list should refresh automatically when indexing is done, but for some reason it doesn't work reliably. If you start typing after several seconds and the indexing is done it will show applications.

There couple more things we could also try to do like:

Exidex commented 2 days ago

If applications do not show up at all, then the problem is in the indexing process because currently it is all or nothing. In this case I would need the logs:

  1. Stop existing instance of application (e.g. via menu item)
  2. In terminal set environment variable:
    export RUST_LOG=server=DEBUG
  3. Start the app:
    open -n /Applications/Gauntlet.app --stdout ~/gauntlet-log --stderr ~/gauntlet-log
  4. Wait for like 30 seconds
  5. And then send the ~/gauntlet-log file here. There shouldn't be any sensitive information but doesn't hurt to double check
diogox commented 2 days ago

gauntlet.log

And the contents of /System/Library/CoreServices/SystemVersion.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>BuildID</key>
    <string>[REDACTED]</string>
    <key>ProductBuildVersion</key>
    <string>24A335</string>
    <key>ProductCopyright</key>
    <string>1983-2024 Apple Inc.</string>
    <key>ProductName</key>
    <string>macOS</string>
    <key>ProductUserVisibleVersion</key>
    <string>15.0</string>
    <key>ProductVersion</key>
    <string>15.0</string>
    <key>iOSSupportVersion</key>
    <string>18.0</string>
</dict>
</plist>

Seems like an issue with the regex for ProductVersion.

diogox commented 2 days ago

So the issue is that when first opening the app it needs to index all existing applications and most importantly to create small icons to make it usable in the app and it takes some time. I haven't done an optimization pass on it yet to make it faster. The list should refresh automatically when indexing is done, but for some reason it doesn't work reliably. If you start typing after several seconds and the indexing is done it will show applications.

There couple more things we could also try to do like:

  • add loading bar to show something is happening, but not sure how distracting it will be
  • changing the command generator api to show applications as they are indexed and not wait for all to finish indexing

On this, seems Spotlight does both show existing results and a progress bar for indexing. CleanShot 2024-10-05 at 16 22 47@2x

Exidex commented 1 day ago

Seems like an issue with the regex for ProductVersion.

Should be fixed in https://github.com/project-gauntlet/gauntlet/commit/72db547a998b3a2655b728da7d929a837d742e2e

diogox commented 1 day ago

The regex issue looks fixed, but there's another panic further down when calling plist::from_file::<PathBuf, Info>(info_path)

2024-10-05T17:32:09.271211Z  INFO server::plugins: Registering new global shortcut: PhysicalShortcut { physical_key: Space, modifier_shift: false, modifier_control: false, modifier_alt: false, modifier_meta: true }
2024-10-05T17:32:09.294567Z  INFO server::plugins: Saving builtin plugin with id: "applications" target="plugin"
2024-10-05T17:32:09.299473Z DEBUG server::plugins::loader: Plugin config read: PluginManifest { gauntlet: PluginManifestMetadata { name: "Applications", description: "Run applications from your system as commands" }, entrypoint: [PluginManifestEntrypoint { id: "default", name: "Default", description: "", path: "src/default.ts", icon: None, entrypoint_type: CommandGenerator, preferences: [], actions: [] }], supported_system: [Linux, MacOS, Windows], permissions: PluginManifestPermissions { environment: [], network: [], filesystem: PluginManifestPermissionsFileSystem { read: [], write: [] }, exec: PluginManifestPermissionsExec { command: [], executable: [] }, system: [], clipboard: [], main_search_bar: [] }, preferences: [] }
2024-10-05T17:32:09.302359Z  INFO server::plugins: Reloading plugin with id: PluginId("builtin://applications") target="plugin"
2024-10-05T17:32:09.302456Z  INFO server::plugins: Starting plugin with id: PluginId("builtin://applications") target="plugin"
2024-10-05T17:32:09.303216Z  INFO server::plugins: Saving builtin plugin with id: "calculator" target="plugin"
2024-10-05T17:32:09.303892Z DEBUG server::plugins::loader: Plugin config read: PluginManifest { gauntlet: PluginManifestMetadata { name: "Calculator", description: "" }, entrypoint: [PluginManifestEntrypoint { id: "default", name: "Default", description: "", path: "src/default.tsx", icon: None, entrypoint_type: InlineView, preferences: [], actions: [] }], supported_system: [], permissions: PluginManifestPermissions { environment: [], network: [], filesystem: PluginManifestPermissionsFileSystem { read: [], write: [] }, exec: PluginManifestPermissionsExec { command: [], executable: [] }, system: [], clipboard: [], main_search_bar: [Read] }, preferences: [] }
2024-10-05T17:32:09.304791Z  INFO server::plugins: Reloading plugin with id: PluginId("builtin://calculator") target="plugin"
2024-10-05T17:32:09.304890Z  INFO server::plugins: Starting plugin with id: PluginId("builtin://calculator") target="plugin"
2024-10-05T17:32:09.305152Z  INFO server::plugins: Saving builtin plugin with id: "settings" target="plugin"
2024-10-05T17:32:09.305629Z DEBUG server::plugins::loader: Plugin config read: PluginManifest { gauntlet: PluginManifestMetadata { name: "Settings", description: "" }, entrypoint: [PluginManifestEntrypoint { id: "default", name: "Open Gauntlet Settings", description: "", path: "src/default.tsx", icon: None, entrypoint_type: Command, preferences: [], actions: [] }], supported_system: [], permissions: PluginManifestPermissions { environment: [], network: [], filesystem: PluginManifestPermissionsFileSystem { read: [], write: [] }, exec: PluginManifestPermissionsExec { command: [], executable: [] }, system: [], clipboard: [], main_search_bar: [] }, preferences: [] }
2024-10-05T17:32:09.306643Z  INFO server::plugins: Reloading plugin with id: PluginId("builtin://settings") target="plugin"
2024-10-05T17:32:09.306725Z  INFO server::plugins: Starting plugin with id: PluginId("builtin://settings") target="plugin"
2024-10-05T17:32:09.306932Z  INFO server::plugins: Reloading all plugins
2024-10-05T17:32:09.306961Z  INFO server::plugins::config_reader: No config found, using default configuration
2024-10-05T17:32:09.356073Z  INFO server::plugins::js::logs: target="command_generator" plugin_id="builtin://applications" Running command generator for entrypoint default
2024-10-05T17:32:09.356581Z DEBUG server::search: Reloading search index for plugin PluginId("builtin://settings") "Settings" using following data: [SearchIndexItem { entrypoint_type: Command, entrypoint_name: "Open Gauntlet Settings", entrypoint_id: EntrypointId("default"), entrypoint_icon_path: None, entrypoint_frecency: 6.024197155315418, entrypoint_actions: [] }]
2024-10-05T17:32:09.357123Z DEBUG server::plugins::applications::macos: Found following macOS setting preference ids: ["com.apple.systempreferences.AppleIDSettings", "com.apple.Family-Settings.extension", "com.apple.FollowUpSettings.FollowUpSettingsExtension", "com.apple.wifi-settings-extension", "com.apple.BluetoothSettings", "com.apple.Network-Settings.extension", "com.apple.NetworkExtensionSettingsUI.NESettingsUIExtension", "com.apple.ClassroomSettings", "com.apple.Classroom-Settings.extension", "com.apple.Notifications-Settings.extension", "com.apple.Sound-Settings.extension", "com.apple.Focus-Settings.extension", "com.apple.Screen-Time-Settings.extension", "com.apple.systempreferences.GeneralSettings", "com.apple.Appearance-Settings.extension", "com.apple.Accessibility-Settings.extension", "com.apple.ControlCenter-Settings.extension", "com.apple.Siri-Settings.extension", "com.apple.Spotlight-Settings.extension", "com.apple.settings.PrivacySecurity.extension", "com.apple.Desktop-Settings.extension", "com.apple.Displays-Settings.extension", "com.apple.Wallpaper-Settings.extension", "com.apple.ScreenSaver-Settings.extension", "com.apple.Battery-Settings.extension", "com.apple.Lock-Screen-Settings.extension", "com.apple.Touch-ID-Settings.extension", "com.apple.Users-Groups-Settings.extension", "com.apple.Passwords-Settings.extension", "com.apple.Passwords", "com.apple.Internet-Accounts-Settings.extension", "com.apple.Game-Center-Settings.extension", "com.apple.WalletSettingsExtension", "com.apple.HeadphoneSettings", "com.apple.Keyboard-Settings.extension", "com.apple.Mouse-Settings.extension", "com.apple.Trackpad-Settings.extension", "com.apple.Game-Controller-Settings.extension", "com.apple.CD-DVD-Settings.extension", "com.apple.Print-Scan-Settings.extension", "com.apple.preferences.ClassKitPreferencePane"]
thread 'tokio-runtime-worker' panicked at rust/server/src/plugins/applications/macos.rs:128:22:
Unexpected Info.plist for System Extensions: Error { inner: ErrorImpl { kind: Serde("missing field `CFBundleIdentifier`"), file_position: None } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error occurred when calling command generator for entrypoint: default Error: task 57 panicked
    at async Default (gauntlet:entrypoint?default:5:13)
    at async runCommandGenerators (gauntlet:core:15:40)
2024-10-05T17:32:09.361859Z DEBUG server::search: Reloading search index for plugin PluginId("builtin://applications") "Applications" using following data: []
2024-10-05T17:32:09.463963Z  INFO server::search: requesting search results update because search index update for plugin: PluginId("builtin://settings")
2024-10-05T17:32:09.464678Z  INFO server::search: requesting search results update because search index update for plugin: PluginId("builtin://applications")
2024-10-05 18:32:09.557 gauntlet[15456:814112] +[IMKClient subclass]: chose IMKClient_Legacy
2024-10-05T17:32:09.828635Z DEBUG server::search: Reloading search index for plugin PluginId("builtin://calculator") "Calculator" using following data: []
2024-10-05T17:32:09.829467Z  INFO server::search: requesting search results update because search index update for plugin: PluginId("builtin://calculator")
Exidex commented 1 day ago

Because I do not have macOS Sequoia to properly test and fix this, for now I just added graceful error handling if plugin faces issues when parsing plist, only that single setting will not be added. c021fbab7e54836d915539183d578d34b7a95294

diogox commented 1 day ago

Sorry, I spent some time trying debug this, but haven't messed with Rust in a long time so having a hard time reading the code.

I do see what you mean about the indexing taking a long time, though. And, as far as I can tell, even after it's finished no results show up :(

I also noticed Gauntlet is not reading directly from /Applications, but instead goes into /System/Library/CoreServices/....

The issue we were having before (can't tell if still having) is some files don't have a CFBundleIdentifier field, like this one:

/System/Library/ExtensionKit/Extensions/AppIntentsSettingsExtension.appex/Contents/Info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>BuildMachineOSBuild</key>
    <string>22A380021</string>
    <key>CFBundleSupportedPlatforms</key>
    <array>
        <string>MacOSX</string>
    </array>
    <key>DTCompiler</key>
    <string>com.apple.compilers.llvm.clang.1_0</string>
    <key>DTPlatformBuild</key>
    <string>24A318</string>
    <key>DTPlatformName</key>
    <string>macosx</string>
    <key>DTPlatformVersion</key>
    <string>15.0</string>
    <key>DTSDKBuild</key>
    <string>24A318</string>
    <key>DTSDKName</key>
    <string>macosx15.0.internal</string>
    <key>DTXcode</key>
    <string>1600</string>
    <key>DTXcodeBuild</key>
    <string>16A6170g</string>
    <key>EXAppExtensionAttributes</key>
    <dict>
        <key>EXExtensionPointIdentifier</key>
        <string>com.apple.appintents-extension</string>
    </dict>
    <key>LSMinimumSystemVersion</key>
    <string>15.0</string>
</dict>
</plist>
diogox commented 1 day ago

gauntlet.log

Logs look good, yet no results show up.

Exidex commented 1 day ago

I do see what you mean about the indexing taking a long time

Looking at logs, for you indexing takes 5-6 seconds. Not that good but could have been worse, i guess.

I also noticed Gauntlet is not reading directly from /Applications, but instead goes into /System/Library/CoreServices/....

/System/Library/CoreServices/ directory contains Finder and other system stuff. The log does contain info about indexing /Application/ so that is good.

But there are couple of things weird with that log file. First there are no logs regarding indexing settings at all, including log about parsing error of the file content that you posted which should be there. And the second search index reload seems to be done before command generation which ... does not make sense. It is also possible that the log file is incomplete.

Can you please try to run it again but with latest main branch and clean re-build following Build instructions in README and send the log file again?

diogox commented 1 day ago

You're right, I think the last log I sent you had some changes from when I was debugging.

I ran a clean build and it works 🎉

CleanShot 2024-10-06 at 11 19 47@2x

Here's the log in case it's useful: gauntlet.log

Thanks!

Exidex commented 1 day ago

Great! Thank you for all the help debugging.

As previously, I will keep this issue open until the release.