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

[WIP] nixos/open-with: init #88025

Open
wants to merge 1 commit into
base: master
from
Open

[WIP] nixos/open-with: init #88025

wants to merge 1 commit into from

Conversation

@SRGOM
Copy link
Member

SRGOM commented May 17, 2020

Motivation for this change

Some discussion here- https://discourse.nixos.org/t/configure-how-xdg-open-opens-html-files/6419/22

On my computer currently- these are the liens in mimeinfo.cache

application/pdf=inkscape.desktop;org.gnome.Evince.desktop;pqiv.desktop;texworks.desktop;
inode/directory=code.desktop;pcmanfm.desktop;ranger.desktop;spacefm-find.desktop;spacefm-folder-handler.desktop;spacefm.desktop;vifm.desktop;
video/mp4=pqiv.desktop;vlc.desktop;

meaning that pdf is (not) opened in Inkscape, directory is (at a leisurely pace) opened in Visual Studio Code and mp4 (barely) opens in pqiv.

At this point one would refer to Arch wiki to figure out how to override these settings manually. However, two of the probably most popular programs around this- xdg-open and mimeopen do not concur on how to do so. It appears that they read different files. The obvious solution would be to link to another but that doesn't work because, in my recollection one of those files is such that it is deleted and recreated upon every edit.

So it seems that the only sane solution is to override the global (computer-wide) defaults because everybody seems to respect that at least.

This code adds an option programs.defaults.defaults to achieve that.

This is a work in progress and this doesn't actually work but I think I've done the hard part of actual logic, what I haven't managed is the final part of were to read mimeinfo.cache from

Things done

Not application because this doesn't work, I'm seeking help here Will update.

_
@nixos-discourse
Copy link

nixos-discourse commented May 17, 2020

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/configure-how-xdg-open-opens-html-files/6419/24

@SRGOM
Copy link
Member Author

SRGOM commented May 17, 2020

Since this code isn't functional, there is probably not a lot of point in talking about the format of this option but briefly- you can either mention a package (and a single .desktop file is set as the default) or explicitly specify a .desktop file. Multiple entries could be specified in a list optionally.

Example:


	example = { 
		"application/pdf" = [ pkgs.zathura "${pkgs.evince}/share/applications/org.gnome.Evince.desktop" ];
		"inode/directory" = [ "${pkgs.spaceFM}/share/applications/spacefm.desktop" pkgs.ranger pkgs.vifm ];
		"video/mp4" = pkgs.vlc;
	} ; 
@nixos-discourse
Copy link

nixos-discourse commented May 19, 2020

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/help-needed-environment-extrasetup-and-os-wide-default-application-launcher/7274/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.