diff --git a/Azayaka/AppDelegate.swift b/Azayaka/AppDelegate.swift index 5b06a8d..5224731 100644 --- a/Azayaka/AppDelegate.swift +++ b/Azayaka/AppDelegate.swift @@ -37,7 +37,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, SCStreamDelegate, SCStreamOu let ud = UserDefaults.standard func applicationDidFinishLaunching(_ aNotification: Notification) { - let userDesktop = (NSSearchPathForDirectoriesInDomains(.desktopDirectory, .userDomainMask, true) as [String]).first + lazy var userDesktop = (NSSearchPathForDirectoriesInDomains(.desktopDirectory, .userDomainMask, true) as [String]).first! + + // the `com.apple.screencapture` domain has the user set path for where they want to store screenshots or videos + let saveDirectory = (UserDefaults(suiteName: "com.apple.screencapture")?.string(forKey: "location") ?? userDesktop) as NSString + ud.register( // default defaults (used if not set) defaults: [ "audioFormat": AudioFormat.aac.rawValue, @@ -45,7 +49,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, SCStreamDelegate, SCStreamOu "frameRate": 60, "videoFormat": VideoFormat.mp4.rawValue, "encoder": Encoder.h264.rawValue, - "saveDirectory": userDesktop!, + "saveDirectory": saveDirectory, "hideSelf": false ] )