diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2021-06-25 03:50:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-25 03:50:44 +0200 |
commit | 27bbb94761758d4926c07215cdb456c03c382c68 (patch) | |
tree | f1f8915f59e1d422a97c301ee1f32cc4a7232738 /nixos | |
parent | 3b392e8951cef55c2c56e8549107ccd0f1920f0d (diff) | |
parent | ab15091abeb4da09df74503a12dc80774958f3b7 (diff) |
Merge pull request #127085 from minijackson/xdg-desktop-portal-wlr-0.4.0-and-module
xdg-desktop-portal-wlr: 0.3.0 -> 0.4.0 and module
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/configuration/wayland.xml | 10 | ||||
-rw-r--r-- | nixos/modules/config/xdg/portals/wlr.nix | 67 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 |
3 files changed, 78 insertions, 0 deletions
diff --git a/nixos/doc/manual/configuration/wayland.xml b/nixos/doc/manual/configuration/wayland.xml index 231c219cf0811..2aefda3e22c01 100644 --- a/nixos/doc/manual/configuration/wayland.xml +++ b/nixos/doc/manual/configuration/wayland.xml @@ -20,4 +20,14 @@ essential utilities. Now you can start <package>sway</package> from the TTY console. </para> + + <para> + If you are using a wlroots-based compositor, like sway, and want to be able to + share your screen, you might want to activate this option: +<programlisting> +<xref linkend="opt-xdg.portal.wlr.enable"/> = true; +</programlisting> + and configure Pipewire using <xref linkend="opt-services.pipewire.enable"/> + and related options. + </para> </chapter> diff --git a/nixos/modules/config/xdg/portals/wlr.nix b/nixos/modules/config/xdg/portals/wlr.nix new file mode 100644 index 0000000000000..55baab0026b26 --- /dev/null +++ b/nixos/modules/config/xdg/portals/wlr.nix @@ -0,0 +1,67 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.xdg.portal.wlr; + package = pkgs.xdg-desktop-portal-wlr; + settingsFormat = pkgs.formats.ini { }; + configFile = settingsFormat.generate "xdg-desktop-portal-wlr.ini" cfg.settings; +in +{ + meta = { + maintainers = with maintainers; [ minijackson ]; + }; + + options.xdg.portal.wlr = { + enable = mkEnableOption '' + desktop portal for wlroots-based desktops + + This will add the <package>xdg-desktop-portal-wlr</package> package into + the <option>xdg.portal.extraPortals</option> option, and provide the + configuration file + ''; + + settings = mkOption { + description = '' + Configuration for <package>xdg-desktop-portal-wlr</package>. + + See <literal>xdg-desktop-portal-wlr(5)</literal> for supported + values. + ''; + + type = types.submodule { + freeformType = settingsFormat.type; + }; + + default = { }; + + # Example taken from the manpage + example = literalExample '' + { + screencast = { + output_name = "HDMI-A-1"; + max_fps = 30; + exec_before = "disable_notifications.sh"; + exec_after = "enable_notifications.sh"; + chooser_type = "simple"; + chooser_cmd = "''${pkgs.slurp}/bin/slurp -f %o -or"; + }; + } + ''; + }; + }; + + config = mkIf cfg.enable { + xdg.portal = { + enable = true; + extraPortals = [ package ]; + }; + + systemd.user.services.xdg-desktop-portal-wlr.serviceConfig.ExecStart = [ + # Empty ExecStart value to override the field + "" + "${package}/libexec/xdg-desktop-portal-wlr --config=${configFile}" + ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 1a4c2fb719dcc..8a96b42c556ba 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -9,6 +9,7 @@ ./config/xdg/menus.nix ./config/xdg/mime.nix ./config/xdg/portal.nix + ./config/xdg/portals/wlr.nix ./config/appstream.nix ./config/console.nix ./config/xdg/sounds.nix |