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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

SRGOM
Copy link
Member

@SRGOM 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

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

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

@ryantm ryantm marked this pull request as draft October 23, 2020 03:01
@asdf8dfafjk asdf8dfafjk mentioned this pull request Jun 1, 2021
8 tasks
@stale
Copy link

stale bot commented Jun 4, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2021
@Congee
Copy link
Contributor

Congee commented Oct 13, 2021

Is this PR abandoned?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 13, 2021
@SuperSandro2000
Copy link
Member

Is this PR abandoned?

I think so. There was no activity since May laste year. Also the goal of the PR can be achieved with xdg-open already.

@asdf8dfafjk
Copy link
Contributor

@Congee

This is the follow up #125147

@SuperSandro2000
xdg-open cannot handle this, you missed the text of my first post.

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

Successfully merging this pull request may close these issues.

None yet

5 participants