···
+
{ config, lib, pkgs, ... }:
+
cfg = config.services.compton;
+
configFile = pkgs.writeText "compton.conf"
+
(optionalString cfg.fade ''
+
fade-delta = ${toString cfg.fadeDelta};
+
fade-in-step = ${elemAt cfg.fadeSteps 0};
+
fade-out-step = ${elemAt cfg.fadeSteps 1};
+
fade-exclude = ${toJSON cfg.fadeExclude};
+
optionalString cfg.shadow ''
+
shadow-offset-x = ${toString (elemAt cfg.shadowOffsets 0)};
+
shadow-offset-y = ${toString (elemAt cfg.shadowOffsets 1)};
+
shadow-opacity = ${cfg.shadowOpacity};
+
shadow-exclude = ${toJSON cfg.shadowExclude};
+
active-opacity = ${cfg.activeOpacity};
+
inactive-opacity = ${cfg.inactiveOpacity};
+
menu-opacity = ${cfg.menuOpacity};
+
backend = ${toJSON cfg.backend};
+
vsync = ${toJSON cfg.vSync};
+
refresh-rate = ${toString cfg.refreshRate};
+
'' + cfg.extraOptions);
+
options.services.compton = {
+
Whether of not to enable Compton as the X.org composite manager.
+
Fade windows in and out.
+
Time between fade animation step (in ms).
+
type = types.listOf types.str;
+
default = [ "0.028" "0.03" ];
+
example = [ "0.04" "0.04" ];
+
Opacity change between fade steps (in and out).
+
fadeExclude = mkOption {
+
type = types.listOf types.str;
+
"window_type *= 'menu'"
+
List of condition of windows that should have no shadow.
+
See <literal>compton(1)</literal> man page for more examples.
+
shadowOffsets = mkOption {
+
type = types.listOf types.int;
+
default = [ (-15) (-15) ];
+
example = [ (-10) (-15) ];
+
Left and right offset for shadows (in pixels).
+
shadowOpacity = mkOption {
+
Window shadows opacity (number in range 0 - 1).
+
shadowExclude = mkOption {
+
type = types.listOf types.str;
+
"window_type *= 'menu'"
+
List of condition of windows that should have no shadow.
+
See <literal>compton(1)</literal> man page for more examples.
+
activeOpacity = mkOption {
+
Opacity of active windows.
+
inactiveOpacity = mkOption {
+
Opacity of inactive windows.
+
menuOpacity = mkOption {
+
Opacity of dropdown and popup menu.
+
Backend to use: <literal>glx</literal> or <literal>xrender</literal>.
+
example = "opengl-swc";
+
Enable vertical synchronization using the specified method.
+
See <literal>compton(1)</literal> man page available methods.
+
refreshRate = mkOption {
+
Screen refresh rate (0 = automatically detect).
+
default = pkgs.compton;
+
example = literalExample "pkgs.compton";
+
Compton derivation to use.
+
extraOptions = mkOption {
+
unredir-if-possible = true;
+
Additional Compton configuration.
+
config = mkIf cfg.enable {
+
systemd.user.services.compton = {
+
description = "Compton composite manager";
+
wantedBy = [ "default.target" ];
+
ExecStart = "${cfg.package}/bin/compton --config ${configFile}";
+
environment.DISPLAY = ":0";
+
environment.systemPackages = [ cfg.package ];