Skip to content

Commit

Permalink
make save location the user's chosen by default
Browse files Browse the repository at this point in the history
  • Loading branch information
NSAntoine committed Sep 29, 2023
1 parent 39f92bd commit 2e132a0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Azayaka/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,19 @@ 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,
"audioQuality": AudioQuality.high.rawValue,
"frameRate": 60,
"videoFormat": VideoFormat.mp4.rawValue,
"encoder": Encoder.h264.rawValue,
"saveDirectory": userDesktop!,
"saveDirectory": saveDirectory,
"hideSelf": false
]
)
Expand Down

0 comments on commit 2e132a0

Please sign in to comment.