노틸러스는 파일 형식 설명을 어디에서 얻습니까?

노틸러스는 파일 형식 설명을 어디에서 얻습니까?

사용자 정의 파일 형식에 대한 일부 공유 MIME 정보 파일을 생성하고 등록했습니다. 예를 들어,

~/.local/share/mime/packages

다음과 같은 파일을 추가했습니다.

x-myokit.xml

다음과 같은 MIME 유형 설명을 포함합니다.

<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/x-myokit">
    <comment xml:lang="en">Myokit model definition</comment>
    <glob pattern="*.mmt"/>
  </mime-type>
</mime-info>

노틸러스는 이제 내 파일을 인식하지만 여전히 파일 형식을 "알 수 없음"으로 표시합니다. 이 열에 더 유용한 콘텐츠를 표시하려면 어떻게 해야 합니까?

답변1

Nautilus이는 개발자의 재량에 따라 하드코딩됩니다.기본 유형 정보만 표시기본적으로는 열에 있으므로 Type유형별로 정렬하면 유형 시리즈가 그룹화됩니다.
기본 유형은 다음에 정의되어 있습니다.노틸러스 파일.c일반(기호) 아이콘 이름을 기반으로 함 1 :

struct {
        const char *icon_name;
        const char *display_name;
} mime_type_map[] = {
    { "application-x-executable", N_("Program") },
    { "audio-x-generic", N_("Audio") },
    { "font-x-generic", N_("Font") },
    { "image-x-generic", N_("Image") },
    { "package-x-generic", N_("Archive") },
    { "text-html", N_("Markup") },
    { "text-x-generic", N_("Text") },
    { "text-x-generic-template", N_("Text") },
    { "text-x-script", N_("Program") },
    { "video-x-generic", N_("Video") },
    { "x-office-address-book", N_("Contacts") },
    { "x-office-calendar", N_("Calendar") },
    { "x-office-document", N_("Document") },
    { "x-office-presentation", N_("Presentation") },
    { "x-office-spreadsheet", N_("Spreadsheet") },
};

위의 범주에 속하지 않는 유형은 다음과 같습니다 Unknown.

if (basic_type == NULL) {
    basic_type = g_strdup (_("Unknown"));

결과적으로 MIME 유형 application/x-myokit(해당 기호 아이콘 이름 포함) 이 있는 파일 application-x-generic은 열에 나열되고 MIME 유형(해당 기호 아이콘 이름 포함)이 있는 파일은 열에 나열됩니다(다음과 같은 다양한 시스템 파일 참조). 파일 아래 또는 파일 내 - 모두 나열되어 있지만 그 중 하나를 선택하고 +를 클릭하면 상세하고 정확한 정보를 얻을 수 있습니다.UnknownTypetext/x-myokittext-x-genericTextType*.so/usr/lib*.mo/usr/share/localeUnknownAltEnter


generic-icon name파일에서 사용하는 경우 노틸러스에게 다른 항목을 나열하도록 요청할 수 있습니다 xml. 귀하의 선택은 위에서 언급한 카테고리로 제한되어 있습니다. 예를 들어 모든 파일을 하나의 열에 나열하려면 *.mmt다음과 같이 편집하면 됩니다.ProgramTypex-myokit.xml

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
    <mime-type type="application/x-myokit">
        <comment>Myokit model definition</comment>
        <generic-icon name="text-x-script"/>
        <glob pattern="*.mmt"/>
    </mime-type>
</mime-info>

다음 명령을 사용하여 MIME 데이터베이스를 업데이트하는 것을 잊지 마십시오:

update-mime-database ~/.local/share/mime

더 유용한 정보가 필요한 경우 환경설정에서 해당 MIME type열을 활성화/확인할 수 있습니다 Nautilus(또는 dconf/ gsettings:에 추가 mime_type사용 org.gnome.nautilus.list-view default-visible-columns).

1: 해당 기호 아이콘 이름을 보려면 실행하세요 ( gio info -a standard::symbolic-icon file이전 설정에서 gio info대체됨 gvfs-info).

답변2

나는 노틸러스가 위치에서 파일 설명을 얻는다고 믿습니다 /usr/share/applications. 내 다른 답변에서 더 유용한 정보를 찾을 수 있습니다여기. 특별한,이것Ask Ubuntu의 답변에서는 파일 연결이 저장되는 방법에 대해 자세히 설명합니다.

파일 관리자(기본적으로 Nautilus)는 파일의 MIME 유형을 사용하여 파일을 여는 데 사용할 프로그램을 결정합니다. 응용 프로그램을 설치할 때 열 수 있는 MIME 유형과 .desktop 파일(.desktop 파일에 있음)에서 파일을 여는 데 사용되는 명령을 지정할 수 있습니다 /usr/share/applications. 메뉴, 바탕화면 바로가기 등에 사용되는 파일입니다.

관련 정보