Mac OS X의“최근에 열기”메뉴에서 단일 항목을 어떻게 제거합니까?


8

대부분의 문서 기반 Mac OS X 응용 프로그램에는 File ---> Open Recent ... 메뉴 항목이 있습니다. 프로그램에서 연 최근 파일 목록입니다. 모든 항목을 제거하는 것은 쉽습니다. Clear Menu 를 선택하기 만하면 됩니다.

그러나 때로는 더 이상 존재하지 않는 파일 또는 다시는보고 싶지 않은 항목과 같이 모든 항목이 아닌 하나 또는 두 개의 항목 만 제거하려고 할 수 있습니다. 다른 항목을 제거하지 않고 최근 항목 열기 목록에서 단일 항목을 제거하는 방법은 무엇입니까?

최근 열기 ... 예


1
더 이상 존재하지 않는 파일은 최근 열기 메뉴 를 올바르게 구현하는 모든 응용 프로그램에 표시되지 않습니다 (Cocoa 기본값을 변경하지 않음).
Daniel Beck

답변:


14

대부분의 응용 프로그램 에서 응용 프로그램 별 최근 문서는 다음 이름의 파일에 있습니다.

~/Library/Preferences/com.company.application.LSSharedFileList.plist

터미널에서이 모든 파일을 나열하려면 다음을 입력하십시오.

ls -Ad Library/Preferences/* | grep LSSharedFileList

Mac OS X 10.6에서 이러한 파일은 일반적으로 이진 형식입니다.

속성 목록 편집기 (Apple Developer Tools / Xcode 3) 또는 Xcode 4를 사용하여 속성을보고 편집하십시오.

애플리케이션이 실행 중이 아닌 애플리케이션이 실행될 때 다시 읽습니다. 이 파일을 편집하는 동안 응용 프로그램을 닫아야합니다.


지루한 것 같아요 ...

#!/usr/bin/env bash

mode=$2
if [ -z "$mode" ] ; then
    echo "Usage:"
    echo "$0 <filename> ls       - list recent file entries in specified *.LSSharedFileList.plist"
    echo "$0 <filename> rm <idx> - remove recent file entry with given index from specified plist"
    exit 1
fi

if [ "$mode" != "ls" ] && [ "$mode" != "rm" ] ; then
    echo "second argument must be one of [ls, rm]"
    exit 1
fi

file=$1
if [ -z $file ] ; then
    echo "Need argument (recent items plist file)!"
    exit 1
fi
if [ ! -f $file ] ; then
    echo "File $file does not exist!"
    exit 1
fi

if [ "$mode" = "ls" ] ; then
    i=0
    cont=1
    while [ $cont ] ; do
        recentfilename=$( /usr/libexec/PlistBuddy -c "Print RecentDocuments:CustomListItems:$i:Name" $file 2>/dev/null )
        if [ "$?" -ne "0" ] ; then
            cont=
        else
            echo "$i - $recentfilename"
            i=$(( $i + 1 ))
        fi
    done
fi

if [ "$mode" = "rm" ] ; then
    i=$3
    if [[ $i =~ ^-?[0-9]+$ ]] ; then
        # argument is integer
        $( /usr/libexec/PlistBuddy -c "Delete RecentDocuments:CustomListItems:$i" $file )
    else
        echo "Expected integer, got $i as third argument"
        exit 1
    fi
fi

용법:

$ ./editrecent.sh 
Usage:
./editrecent.sh <filename> ls       - list recent file entries in specified *.LSSharedFileList.plist
./editrecent.sh <filename> rm <idx> - remove recent file entry with given index from specified plist


$ ./editrecent.sh Library/Preferences/com.macromates.textmate.LSSharedFileList.plist ls
0 - rcd
1 - artifactory.sh
2 - py.py
3 - iTunes Music Library.xml
4 - iTunes Library.xml
5 - gradle-proxy-support.diff
6 - DefaultGradlePropertiesLoader.java
7 - DefaultGradlePropertiesLoader-proxy.java
8 - gradle-proxy-support.patch
9 - DefaultKeyBinding.dict
10 - DefaultKeyBindings.dict

$ ./editrecent.sh Library/Preferences/com.macromates.textmate.LSSharedFileList.plist rm 3

$ ./editrecent.sh Library/Preferences/com.macromates.textmate.LSSharedFileList.plist ls
0 - rcd
1 - artifactory.sh
2 - py.py
3 - iTunes Library.xml
4 - gradle-proxy-support.diff
5 - DefaultGradlePropertiesLoader.java
6 - DefaultGradlePropertiesLoader-proxy.java
7 - gradle-proxy-support.patch
8 - DefaultKeyBinding.dict
9 - DefaultKeyBindings.dict

하하, 스크립트 주셔서 감사합니다! 매우 도움이됩니다! :)
Dave Gallagher 2016

나는 그것이 오래 전이라는 것을 알고 있지만 지금 막이 스크립트를 잡고 있습니다. 시간을내어 작성해 주셔서 감사합니다.
Rob

@Rob 천만에요. 이것은 OS X 10.6 Snow Leopard가 현재 릴리스 일 때 작성되었으므로 그 이후로 변경되었을 수 있습니다.
Daniel Beck

매버릭스에서 변경 사항을 저장하려면 로그 아웃이 필요합니다 (xCode를 다시 열기 전에)!
natanavra

2

당신이 요구하는 것은 지원되는 기능이 아닙니다.

그러나을 편집 /Users/YOURUSERNAME/Library/Preferences/com.apple.recentitems.plist한 다음 로그 아웃했다가 다시 로그인하여 개별 항목을 제거 할 수 있음을 나타내는 지침이 있습니다 .

이 파일은 시스템 전체 히스토리 용입니다. 미리보기 기록에 대한 plist를 찾을 수 없었습니다. Leopard 이상을 실행한다고 가정하면 plist 파일은 바이너리이므로 기본 텍스트 편집기에서 처리 할 수 ​​없습니다. Text Wrangler는 바이너리 plist를 처리 할 수있는 무료 편집기입니다.

출처 : "최근 항목"목록에서 개별 항목 제거

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.