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

Declare mimetypes so things open properly #34

Open
llakala opened this issue Sep 13, 2024 · 6 comments · May be fixed by #65
Open

Declare mimetypes so things open properly #34

llakala opened this issue Sep 13, 2024 · 6 comments · May be fixed by #65
Labels
bug An implementation isn't working as indended software An application downloaded through a package

Comments

@llakala
Copy link
Owner

llakala commented Sep 13, 2024

Currently, basic things like opening files in vscode doesn't work. It should.

@llakala llakala added software An application downloaded through a package major Introducing something new bug An implementation isn't working as indended and removed major Introducing something new labels Sep 13, 2024
@llakala
Copy link
Owner Author

llakala commented Oct 14, 2024

Looking into this now. It's more frustrating than one would expect. I also have been struggling with choosing the proper paradigm.

To stop the analysis paralysis, my goal is now to create a beta version within a branch. It'll probably be ugly, but it should function.

For future reference: I'm thinking of solving my paradigm issues using environment variables. We can set things like the browser and terminal via baseVars. This will make it easy to swap out the apps we're using, without having them declared within a random mimetypes file.

@llakala
Copy link
Owner Author

llakala commented Oct 14, 2024

If we add anything to helix, it seems to try to recompile it, which sucks.

This was just because of a problem where for helix to be compiled, the flake.lock had to be updated, but that commit was only on main.

Running into some issues getting things to open within kitty and helix. When I make text/plain direct to helix.desktop, it opens in Gnome Terminal. When I make it direct to kitty.desktop, it thinks we're sending every line as its own command. When it directs to kitty-open.desktop, it opens in Kitty, but it fails to work for some files, specifically nix files.
image

However, it does open .py files completely fine.
image

After using xdg-mime query, .py files seem to be marked as text/x-python. Meanwhile, .nix files are marked as text/plain.

I'll have to look into this further.

@llakala
Copy link
Owner Author

llakala commented Oct 14, 2024

Also, markdown files opening within Obsidian do not seem to work. Obsidian opens, but it's just on the last vault opened, not the specific file.

@llakala
Copy link
Owner Author

llakala commented Oct 14, 2024

Weird: this is marked as text/plain: xdg-mime query filetype "Code of Academic Integrity - acadintegrity.txt"
Yet it works perfectly.

Maybe it's a problem with kitty-open? Perhaps it's never been written to understand nix files.

(Also, opening .sh files don't seem to work, they go to Gnome terminal.

@llakala llakala linked a pull request Oct 14, 2024 that will close this issue
@llakala
Copy link
Owner Author

llakala commented Oct 14, 2024

Was able to get things working with the terminal! I'm using the xdg-terminal-exec standard, which Gnome seems to respect. Thanks to this comment for pointing me in the right direction. This configuration was also invaluable as a resource.

First, let's note the things that DIDN'T work.

Setting text/plain to point to kitty-open.desktop was a failed idea. What tricked me about it was that it felt so close to working. But the problems i was having with it are completely gone after finding a better solution. I actually seem to not need anything with kitty-open.desktop anymore -- XDG has solved this for me. Now, text/plain just points to Helix.

Having xdg-terminal-exec stuff existing WHILE also having x-terminal-emulator stuff set caused strange issues. Here's the output I got when opening Helix from the gnome application menu:

Unknown URL type, cannot open:
  %U
  -e
  hx

The solution seemed to be just to solely rely on xdg-terminal-exec. It solves all my problems and doesn't require any further setup: I put the link to kitty.desktop within the contents of xdg-terminals.list, and everything is great.

There are still issues, like:

  • Obsidian not working for opening markdown files,
  • JAR files opening in Zathura for some reason
  • No automatic handler for tar.gz files

But we've made big headway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An implementation isn't working as indended software An application downloaded through a package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant