I use hyprland, bu twhen I try to use an application that uses the gtk file picker, it just crashes and throws the following error:
(java:25957): GLib-GIO-ERROR **: 15:44:29.716: Settings schema 'org.gtk.Settings.FileChooser' is not installed
I use the hyprland flake with the nixos module and the home-manager module:
programs.hyprland = {
enable = true;
withUWSM = true;
package = inputs.hyprland.packages.${setup.system}.hyprland;
portalPackage = inputs.hyprland.packages.${setup.system}.xdg-desktop-portal-hyprland;
};
home-manager.users.${setup.user} = {
wayland.windowManager.hyprland = {
enable = true;
# ....
};
};
What application, and how did you install and run it?
This is local, it’s a Java Program I wrote, it uses the FileChoserfrom JavaFX which uses the gtk one. On Gnome it worked, but on Hyprland it doesn’t so it seems that there is some kind of issue with the xdg-desktop-portal thingy
I have the same problem for prismlauncher, since it also uses the file picker this way for example
There’s nothing wrong with the portal, you just have to wrap the program via e.g. wrapGAppsHook4. You can look at the thousands of examples in nixpkgs for reference.
But I already did something like this 6 months back and without wrapping anything it worked on hyprland. Do you have an idea why this could be? This isn’t a derivation but simply a local java program, so I expected for it to just open the file picker.
It doesn’t matter how you build it - wrapping is just providing arguments or environment variables to the program (in this case envvars). Otherwise it doesn’t know where to find certain gtk-related data.
So you have to either manually or automatically supply said envvars (and like most people I’m too lazy to do it manually) so that’s why the wrapper hooks exist (and why it’s easier to build stuff with nix if you’re on NixOS).
Alternatively you can create a dev shell and set those envvars in the dev shell if you’re still hacking on the code - see Declarative shell environments with shell.nix — nix.dev documentation.
1 Like
Hmm okay, since this is just something school related, I would rather not actually build any nix derivation, can I use something like wrapGAppsHook4 still to wrap my program? For example I use intellij for java development, what would I do in this situation?
Okay after testing around a little bit it seems the environment variable GSETTINGS_SCHEMA_DIR was not set, after adding the following to my nixos configuration I fixed it, maybe I should use a devshell after all:
environment.variables = {
GSETTINGS_SCHEMA_DIR = "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}/glib-2.0/schemas";
};
Thank you for helping me bisect this issue. ily
Would make sense to use a devShell like this: JavaFX can not find glassgtk3 · Issue #338165 · NixOS/nixpkgs · GitHub