gbammc / Thor

Switch the right application ASAP.
MIT License
1.16k stars 69 forks source link

can not add new item #69

Open hgyxbll opened 3 months ago

hgyxbll commented 3 months ago

system: macos 13.6 bug: it can not add new app. reappear step: when click '+', it popup a window to select app, I select it and click ok. nothing added.

I download the code and debug it, and find that at Thor/ShortcutListViewController.swift:49

        openPanel.beginSheetModal(for: view.window!, completionHandler: { (result) in
            if result == NSApplication.ModalResponse.OK, let metaDataItem = NSMetadataItem(url: openPanel.urls.first!) {
                let app = AppModel(item: metaDataItem)

                AppsManager.manager.save(app, shortcut: nil)

                self.tableView.reloadData()
                self.tableView.scrollRowToVisible(self.apps.count - 1)
            }
        })

metaDataItem is null, so can not add item. but openPanel.urls.first have value.

gbammc commented 3 months ago

It seams like NSMetadataItem cannot init with the value of openPanel.urls.first, so what is it?

hgyxbll commented 3 months ago

It seams like NSMetadataItem cannot init with the value of openPanel.urls.first, so what is it? 截屏2024-05-15 20 06 54