반응형
최근 사용 항목 기능은 최근에 사용한 앱이 Apple 메뉴에서 목록으로 표시되고 Dock에 나타나도록합니다. 또한 최근에 사용한 앱 및 서버가 Apple 메뉴에서 목록으로 표시됩니다. 빠르게 앱 또는 파일을 다시 열거나 메뉴에서 서버에 다시 연결할 수 있습니다.
🔎 macOS 최근 사용 항목 수 변경하는 방법 (Change the number of items listed in the Apple menu)
[국문]
- Mac에서 Apple 메뉴> 시스템 환경설정을 선택하고 일반을 클릭하여 최근 사용 항목 팝업 메뉴를 클릭한 다음 숫자를 선택합니다.
[영문]
- On your Mac, choose Apple menu System Preferences, then click General. Click the Recent items pop-up menu, then choose a number.
📂 macOS 최근 사용 항목 경로 (Recent Items path)
~/Library/Application Support/com.apple.sharedfilelist
- /Users/Library/Preferences/.LSShardFileList.plist
- /Users/Library/Preferences/com.apple.finder.plist
- [10.10-] /Users/Library/Preferences/com.apple.recentitems.plist
- [10.11+] /Users/Library/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/.sfl2
- [10.11+] /Users/Library/Library/Application Support/com.apple.sharedfilelist/RecentApplications.sfl2
- [10.11+] /Users/Library/Library/Application Support/com.apple.sharedfilelist/RecentDocuments.sfl2
- [10.11+] /Users/Library/Library/Application Support/com.apple.sharedfilelist/RecentServers.sfl2
- [10.11+] /Users/Library/Library/Application Support/com.apple.sharedfilelist/RecentHosts.sfl2
📔 Get List of recent items Source Code by AppleScript
pplAuse AppleScript version "2.5"
use framework "Foundation"
use scripting additions
property |⌘| : a reference to current application
set recentDocumentsPath to POSIX path of (path to application support from user domain) & "com.apple.sharedfilelist/com.apple.LSSharedFileList.RecentDocuments.sfl2"
set plistData to |⌘|'s NSData's dataWithContentsOfFile:recentDocumentsPath
set recentDocuments to |⌘|'s NSKeyedUnarchiver's unarchiveObjectWithData:plistData
set documentPaths to {}
repeat with aDocument in (recentDocuments's objectForKey:"items")
set documentBookmark to (aDocument's objectForKey:"Bookmark")
set {documentURL, resolveError} to (|⌘|'s NSURL's URLByResolvingBookmarkData:documentBookmark options:0 relativeToURL:(missing value) bookmarkDataIsStale:(missing value) |error|:(reference))
if resolveError is missing value then
set end of documentPaths to documentURL's |path|()
else
display dialog resolveError's localizedDescription as text
end if
end repeat
📔 Get List of recent items Source Code by Swift
// com.apple.LSSharedFileList.RecentDocuments.sfl2
if let data = FileManager.default.contents(atPath: "/Users/[USER_NAME]/Documents/com.apple.LSSharedFileList.RecentDocuments.sfl2") {
if let result = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as? NSDictionary {
if let processing = result["items"] as? NSArray {
//print(result.allKeys)
//print(result.allValues)
for item in processing {
if let dict = item as? NSDictionary, let res = dict["Bookmark"] as? Data {
let path = try NSURL(resolvingBookmarkData: res, options: [], relativeTo: nil, bookmarkDataIsStale: nil)
print(path.path)
}
}
}
}
}
// com.apple.LSSharedFileList.RecentApplications.sfl2
if let dataTwo = FileManager.default.contents(atPath: "/Users/[USER_NAME]/Documents/com.apple.LSSharedFileList.RecentApplications.sfl2") {
if let result = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(dataTwo) as? NSDictionary {
if let processing = result["items"] as? NSArray {
for item in processing {
if let dict = item as? NSDictionary, let res = dict["Bookmark"] as? Data {
let path = try NSURL(resolvingBookmarkData: res, options: [], relativeTo: nil, bookmarkDataIsStale: nil)
print(path.path)
}
}
}
}
}
🚀 REFERENCE
반응형
댓글