{ pkgs, config, lib, ... }: let cfg = config.grimmShared; in { config = with cfg; lib.mkIf (enable && portals) { xdg.icons.enable = true; xdg.sounds.enable = lib.mkIf sound.enable true; xdg.portal = { enable = true; xdgOpenUsePortal = true; extraPortals = with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-kde xdg-desktop-portal-gtk ]; wlr.enable = true; wlr.settings = with lib; mapAttrs' ( name: value: nameValuePair ("screencast_" + name) { output_name = value.id; max_fps = if isInt value.fps then value.fps else (foldl' min 2147483647 value.fps); chooser_type = "simple"; chooser_cmd = "${getExe pkgs.slurp} -f %o -or"; } ) cfg.screens; }; environment.sessionVariables = { XDG_CONFIG_HOME = "$HOME/.config"; }; environment.systemPackages = with pkgs; [ xwaylandvideobridge ]; }; options.grimmShared.portals = lib.mkEnableOption "Enables portals for wlr, gtk and kde as well as fixes fonts"; }