Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve mime-type detection #1474

Closed
giantclambake opened this issue Oct 14, 2024 · 0 comments
Closed

Improve mime-type detection #1474

giantclambake opened this issue Oct 14, 2024 · 0 comments
Assignees

Comments

@giantclambake
Copy link

giantclambake commented Oct 14, 2024

If XDG_DATA_HOME= "$username/.local/share", then it seems ~/.local/share/applications && ~/.local/share/mime/packages will likely exist. These locations represent 'User mode', and allow the user to customize various elements of the desktop environment ...ie; icons. In that case, the user can change/customize settings, as an extension of the System mode settings....ie; if the file ~/.local/share/mime/packages/amiberry.xml exists, and contains the snippet;

    <mime-type type="application/x-amiga--disk-image">
        <comment>Amiga disk image</comment>
        <generic-icon name="media-floppy"/>
        <glob pattern="*.adf"/>
    </mime-type>

Then the mime-type /usr/share/mime/packages/amiberry.xml is still used, but is overridden by ~/.local/share/mime/packages/amiberry.xml (User mode) to provide a different icon for the mime-type defined by System mode.

If XDG_DATA_HOME is unset/unused (Debian, Ubuntu)...then XDG_DATA_DIRS is used instead, and so everything has to be properly covered by /usr/share/mime/packages/amiberry.xml in this case...

....for /usr/share/mime/packages/amiberry.xml ;

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    <mime-type type="application/x-amiga-disk-image">
        <comment>Amiga disk image</comment>
        <generic-icon name="media-floppy"/>
        <magic priority="60">
        <match type="string" value="DOS\x0" offset="0"/>
        </magic>
        <glob pattern="*.adf"/>
    </mime-type>
    <mime-type type="application/x-SPS-virtual-media-image">
        <comment>Interchangeable Preservation Format</comment>
        <generic-icon name="media-floppy"/>
        <magic priority="50">
            <match type="string" value="CAPS" offset="0"/>
        </magic>
        <glob pattern="*.ipf"/>
    </mime-type>
    <mime-type type="application/x-DMS-compressed-disk-image">
        <comment>Disk Masher System</comment>
        <generic-icon name="media-floppy"/>
        <magic priority="50">
            <match type="string" value="DMS!" offset="0"/>
        </magic>
        <glob pattern="*.dms"/>
    </mime-type>
    <mime-type type="application/x-WHDLoad-game-archive">
        <comment>WHDLoad Amiga Package</comment>
        <generic-icon name="input-gaming"/>
        <magic-deleteall/>
        <magic priority="60">
            <match type="big32" value="0x001000084" offset="8:11"/>
        </magic>
        <glob-deleteall/>
        <glob pattern="*.lha"/>
    </mime-type>
</mime-info>

TIA

amiberry.xml.gz

@midwan midwan self-assigned this Oct 15, 2024
@midwan midwan closed this as completed in 20a8024 Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants