Touch paths.
This commit is contained in:
@@ -35,8 +35,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
|
|||||||
{
|
{
|
||||||
HotKeyManager.shared.registerHotKey(key: code, modifiers: mods)
|
HotKeyManager.shared.registerHotKey(key: code, modifiers: mods)
|
||||||
} else {
|
} else {
|
||||||
// NOTE: This is the default shortcut. If you want to change
|
// NOTE: This is the default shortcut. If you want to change it, do not forget to change it in other files
|
||||||
// it, do not forget to change it in other files
|
|
||||||
// (SettingsViewController).
|
// (SettingsViewController).
|
||||||
HotKeyManager.shared.registerHotKey(key: kVK_Space, modifiers: optionKey)
|
HotKeyManager.shared.registerHotKey(key: kVK_Space, modifiers: optionKey)
|
||||||
}
|
}
|
||||||
@@ -79,7 +78,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
|
|||||||
aboutWindow.makeKeyAndOrderFront(nil)
|
aboutWindow.makeKeyAndOrderFront(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This function is triggered by DirMonitor.
|
// NOTE: This function act like a callback is triggered by DirMonitor when file system events occur.
|
||||||
public func fsEventTriggered(_ path: String, _ flags: Int) {
|
public func fsEventTriggered(_ path: String, _ flags: Int) {
|
||||||
if containsFlags(key: kFSEventStreamEventFlagItemCreated, in: flags) ||
|
if containsFlags(key: kFSEventStreamEventFlagItemCreated, in: flags) ||
|
||||||
containsFlags(key: kFSEventStreamEventFlagItemRemoved, in: flags) ||
|
containsFlags(key: kFSEventStreamEventFlagItemRemoved, in: flags) ||
|
||||||
|
|||||||
@@ -133,4 +133,11 @@ final class PathManager {
|
|||||||
}
|
}
|
||||||
refreshFilesystemWatchers()
|
refreshFilesystemWatchers()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Touch paths to load them into CPUs cache.
|
||||||
|
public func touchPaths() {
|
||||||
|
for path in paths {
|
||||||
|
_ = path
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, NSPopoverDele
|
|||||||
backgroundView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
backgroundView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||||
backgroundView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
backgroundView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||||
|
|
||||||
searchInput.widthAnchor.constraint(equalToConstant: 350),
|
searchInput.widthAnchor.constraint(equalToConstant: 400),
|
||||||
searchInput.topAnchor.constraint(equalTo: contentView.topAnchor, constant: ViewConstants.spacing10),
|
searchInput.topAnchor.constraint(equalTo: contentView.topAnchor, constant: ViewConstants.spacing10),
|
||||||
searchInput.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: ViewConstants.spacing15),
|
searchInput.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: ViewConstants.spacing15),
|
||||||
|
|
||||||
@@ -228,8 +228,13 @@ class SearchViewController: NSViewController, NSTextFieldDelegate, NSPopoverDele
|
|||||||
|
|
||||||
view.window?.makeFirstResponder(searchInput)
|
view.window?.makeFirstResponder(searchInput)
|
||||||
// searchInput should select all text whenever window appears.
|
// searchInput should select all text whenever window appears.
|
||||||
NSApp.sendAction(#selector(NSResponder.selectAll(_:)),
|
NSApp.sendAction(#selector(NSResponder.selectAll(_:)), to: nil, from: self)
|
||||||
to: nil, from: self)
|
}
|
||||||
|
|
||||||
|
override func viewWillAppear() {
|
||||||
|
super.viewWillAppear()
|
||||||
|
|
||||||
|
PathManager.shared.touchPaths()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidDisappear() {
|
override func viewDidDisappear() {
|
||||||
|
|||||||
@@ -317,8 +317,7 @@ class SettingsViewController: NSViewController,
|
|||||||
override func viewWillDisappear() {
|
override func viewWillDisappear() {
|
||||||
super.viewWillDisappear()
|
super.viewWillDisappear()
|
||||||
|
|
||||||
HotKeyManager.shared.registerHotKey(key: keyCode,
|
HotKeyManager.shared.registerHotKey(key: keyCode, modifiers: modifiers)
|
||||||
modifiers: modifiers)
|
|
||||||
|
|
||||||
UserDefaults.standard.set(keyCode, forKey: "keyCode")
|
UserDefaults.standard.set(keyCode, forKey: "keyCode")
|
||||||
UserDefaults.standard.set(modifiers, forKey: "keyModifiers")
|
UserDefaults.standard.set(modifiers, forKey: "keyModifiers")
|
||||||
|
|||||||
Reference in New Issue
Block a user