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

Register as .zip/.mrpack handler on macOS and Linux #229

Merged
merged 10 commits into from Nov 5, 2022
Merged

Register as .zip/.mrpack handler on macOS and Linux #229

merged 10 commits into from Nov 5, 2022

Conversation

ryanccn
Copy link
Member

@ryanccn ryanccn commented Oct 22, 2022

Enables opening mrpacks and zips directly via Open with... and importing. Also enables dragging and dropping on the Dock icon to import.

Also makes nice looking file icons like this for mrpacks:

image

Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
@ryanccn ryanccn changed the title Register as .zip/.mrpack handler on macOS Register as .zip/.mrpack handler on macOS/Linux Oct 22, 2022
@ryanccn
Copy link
Member Author

ryanccn commented Oct 22, 2022

added experimental Linux support!

Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
@flowln flowln added the enhancement New feature or request label Oct 22, 2022
@ryanccn
Copy link
Member Author

ryanccn commented Oct 23, 2022

@BeansBeefBroccoli
Copy link

Perhaps

@ryanccn
Copy link
Member Author

ryanccn commented Oct 23, 2022

Can anyone test Windows?

@ryanccn ryanccn changed the title Register as .zip/.mrpack handler on macOS/Linux Register as .zip/.mrpack handler Oct 23, 2022
@DioEgizio
Copy link
Member

d c o

@ryanccn
Copy link
Member Author

ryanccn commented Oct 23, 2022

This seriously makes me want to drop Windows support

@ryanccn ryanccn changed the title Register as .zip/.mrpack handler Register as .zip/.mrpack handler on macOS and Linux Oct 23, 2022
@ryanccn
Copy link
Member Author

ryanccn commented Oct 23, 2022

On Linux, packagers will have to register the .mrpack MIME type themselves depending on the distro. On macOS, this is handled automatically in Info.plist.

@Ryex Ryex mentioned this pull request Oct 23, 2022
@Ryex
Copy link
Contributor

Ryex commented Oct 23, 2022

registering a mime type on linux is usually simple and done with xdg-utils

xdg-icon-resource install --context mimetypes --size 48 modrinth-mrpack.png x-modrinth-modpack

(presuming Modrinth get a .mrpack icon someday)

with a config file according to https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    <mime-type type="application/x-modrinth-modpack+zip">
        <comment>Modrinth Modpack File</comment>
        <icon name="application-x-modrinth-modpack"/>
        <glob-deleteall/>
        <glob pattern="*.mrpack"/>
    </mime-type>
</mime-info>

and then install that with

xdg-mime install modrinth-mrpack-mime.xml

package system hooks usually take care of running update-mime-database for you

I think we should provide the xml file but packagers will need to install it correctly

Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
@ryanccn
Copy link
Member Author

ryanccn commented Oct 24, 2022

DCO.

Copy link
Contributor

@piperswe piperswe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: Ignore me, I didn't see the prior conversation

@ryanccn
Copy link
Member Author

ryanccn commented Oct 27, 2022

review wen :(

Copy link

@BeansBeefBroccoli BeansBeefBroccoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review now

cmake/MacOSXBundleInfo.plist.in Outdated Show resolved Hide resolved
Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
@ryanccn ryanccn requested a review from txtsd October 28, 2022 16:02
@txtsd
Copy link
Member

txtsd commented Oct 28, 2022

Uh I think you forgor to push the changes 💀

@Madis0
Copy link

Madis0 commented Oct 28, 2022

As cool as it seems, doesn't it create more confusion than necessary?
Won't users will accidentally open all zip-archives in Prism or install Modrinth packs in Prism instead of official launcher (whenever that comes)?

What if the user opens a resource pack? Datapack? Texture pack? (aka something pre-1.6)

@ryanccn
Copy link
Member Author

ryanccn commented Oct 29, 2022

Oops-

@ryanccn
Copy link
Member Author

ryanccn commented Nov 1, 2022

review wen

@txtsd txtsd requested a review from flowln November 1, 2022 07:47
@ryanccn
Copy link
Member Author

ryanccn commented Nov 1, 2022

Seems like ECM has an API for registering MIME info, I'll look into it sometime this week 😊

@ryanccn
Copy link
Member Author

ryanccn commented Nov 2, 2022

need some help with this

Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
CMakeLists.txt Outdated Show resolved Hide resolved
@Scrumplex Scrumplex added this to the 6.0 milestone Nov 4, 2022
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
@Scrumplex Scrumplex merged commit 4af22d6 into PrismLauncher:develop Nov 5, 2022
@ryanccn ryanccn deleted the macos-drag-n-drop branch November 5, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants