Junction icon indicating copy to clipboard operation
Junction copied to clipboard

Set as default for images and video

Open gregorni opened this issue 2 years ago • 10 comments

According to feedback from app reviews, setting Junction as default for opening images and videos with a button (similar to how it's set for web links right now) would be a nice feature.

gregorni avatar May 21 '23 11:05 gregorni

This issue raises some questions, like: If the app can be set as default for images, why not also make a button for setting it as default for text files, PDFs, audio, etc.? But how should all these buttons fit in the welcome window? And if that's already there, why not just make one button that sets the app as default for everything in one go?

gregorni avatar May 21 '23 11:05 gregorni

that sets the app as default for everything in one go?

Maybeeeee? We would have to ship the list of all known mime types and add an option in Junction "Remember" so you can opt out for certain types.

If the app can be set as default for images, why not also make a button for setting it as default for text files, PDFs, audio, etc.? But how should all these buttons fit in the welcome window?

My first thought was to do something similar to gcc "Default Apps" panel. But I agree it doesn't work too well with Junction.

Perhaps we could do a list of well known types and let user add new mime types.

  • [ ] Web
  • [ ] Mail
  • [ ] Image
  • [ ] Video
  • [ ] Audio
  • Custom 1 [delete]
  • Custom 2 [delete]

sonnyp avatar May 21 '23 11:05 sonnyp

IIRC @BrainBlasted had thoughts on this when I released Junction

sonnyp avatar May 21 '23 11:05 sonnyp

This is how we currently set Junction as default app https://github.com/sonnyp/Junction/blob/d4b34d731a6b561e01e2976b4d97337b1c99eefd/src/welcome.js#L37

Note that spawn_sync uses flatpak-spawn --host in Flatpak.

sonnyp avatar May 21 '23 11:05 sonnyp

We would have to ship the list of all known mime types and add an option in Junction "Remember" so you can opt out for certain types.

There is also a problem here, because "all mimetypes" also includes stuff like AppImages, which you might not want to open in Junction.

Also, I noticed going through all image and video mimetypes is also a hassle, because you have really many uncommon formats like heic, avif and bmp, and sometimes even app-specific ones like totem-stream, whatever that is, where I'm not sure if they belong in Junction. So the sheer amount of mimetypes might already become a problem.

gregorni avatar May 21 '23 11:05 gregorni

This is how we currently set Junction as default app

https://github.com/sonnyp/Junction/blob/d4b34d731a6b561e01e2976b4d97337b1c99eefd/src/welcome.js#L37

Note that spawn_sync uses flatpak-spawn --host in Flatpak.

Yeah, that's fine. A slightly modified version of that function can be used to set Junction as default for whatever mimetypes you want, but making 50+ setAsDefaultApplicationForX functions seems kind of clunky to me.

Mimetypes/Filetypes are a mess.

gregorni avatar May 21 '23 11:05 gregorni

gio mime isn't the only way to set associations

There is also ~/.config/mimeapps.list

sonnyp avatar May 21 '23 11:05 sonnyp

gio mime isn't the only way to set associations

There is also ~/.config/mimeapps.list

I guess that could also be used. How would that make things easier?

gregorni avatar May 21 '23 11:05 gregorni

We can add numerous entries at once by writing to that file.

GLib has a parser/serializer for this format https://docs.gtk.org/glib/struct.KeyFile.html

sonnyp avatar May 21 '23 12:05 sonnyp

We can add numerous entries at once by writing to that file.

GLib as a parser/serializer for this format https://docs.gtk.org/glib/struct.KeyFile.html

Oh, okay, that's smart. Should be fairly easy in terms of code

gregorni avatar May 21 '23 12:05 gregorni