grimm-nixos-laptop/common/xdg/portals.nix

60 lines
1.2 KiB
Nix
Raw Normal View History

2024-05-07 23:31:41 +02:00
{
pkgs,
config,
lib,
...
}:
2024-04-10 16:51:28 +02:00
let
2024-05-11 22:55:59 +02:00
inherit (config.grimmShared)
enable
portals
sound
screens
;
inherit (lib)
mkIf
mkEnableOption
mapAttrs'
foldl'
min
getExe
isInt
nameValuePair
;
2024-04-10 16:51:28 +02:00
in
{
2024-05-11 22:55:59 +02:00
config = mkIf (enable && portals) {
xdg.icons.enable = true;
xdg.sounds.enable = lib.mkIf sound.enable true;
2024-04-16 13:56:26 +02:00
2024-05-11 22:55:59 +02:00
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-kde
xdg-desktop-portal-gtk
];
2024-04-11 10:56:21 +02:00
2024-05-11 22:55:59 +02:00
wlr.enable = true;
wlr.settings = 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";
}
) screens;
};
2024-03-24 16:59:47 +01:00
2024-05-11 22:55:59 +02:00
environment.sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config";
2024-05-07 23:31:41 +02:00
};
2024-05-11 22:55:59 +02:00
environment.systemPackages = with pkgs; [ xwaylandvideobridge ];
};
options.grimmShared.portals = mkEnableOption "Enables portals for wlr, gtk and kde as well as fixes fonts";
2024-03-24 16:59:47 +01:00
}