···
1
+
{ config, lib, pkgs, ... }:
8
+
cfg = config.services.compton;
10
+
configFile = pkgs.writeText "compton.conf"
11
+
(optionalString cfg.fade ''
14
+
fade-delta = ${toString cfg.fadeDelta};
15
+
fade-in-step = ${elemAt cfg.fadeSteps 0};
16
+
fade-out-step = ${elemAt cfg.fadeSteps 1};
17
+
fade-exclude = ${toJSON cfg.fadeExclude};
19
+
optionalString cfg.shadow ''
23
+
shadow-offset-x = ${toString (elemAt cfg.shadowOffsets 0)};
24
+
shadow-offset-y = ${toString (elemAt cfg.shadowOffsets 1)};
25
+
shadow-opacity = ${cfg.shadowOpacity};
26
+
shadow-exclude = ${toJSON cfg.shadowExclude};
30
+
active-opacity = ${cfg.activeOpacity};
31
+
inactive-opacity = ${cfg.inactiveOpacity};
32
+
menu-opacity = ${cfg.menuOpacity};
35
+
backend = ${toJSON cfg.backend};
36
+
vsync = ${toJSON cfg.vSync};
37
+
refresh-rate = ${toString cfg.refreshRate};
38
+
'' + cfg.extraOptions);
42
+
options.services.compton = {
48
+
Whether of not to enable Compton as the X.org composite manager.
57
+
Fade windows in and out.
61
+
fadeDelta = mkOption {
66
+
Time between fade animation step (in ms).
70
+
fadeSteps = mkOption {
71
+
type = types.listOf types.str;
72
+
default = [ "0.028" "0.03" ];
73
+
example = [ "0.04" "0.04" ];
75
+
Opacity change between fade steps (in and out).
79
+
fadeExclude = mkOption {
80
+
type = types.listOf types.str;
83
+
"window_type *= 'menu'"
84
+
"name ~= 'Firefox$'"
88
+
List of condition of windows that should have no shadow.
89
+
See <literal>compton(1)</literal> man page for more examples.
98
+
Draw window shadows.
102
+
shadowOffsets = mkOption {
103
+
type = types.listOf types.int;
104
+
default = [ (-15) (-15) ];
105
+
example = [ (-10) (-15) ];
107
+
Left and right offset for shadows (in pixels).
111
+
shadowOpacity = mkOption {
116
+
Window shadows opacity (number in range 0 - 1).
120
+
shadowExclude = mkOption {
121
+
type = types.listOf types.str;
124
+
"window_type *= 'menu'"
125
+
"name ~= 'Firefox$'"
129
+
List of condition of windows that should have no shadow.
130
+
See <literal>compton(1)</literal> man page for more examples.
134
+
activeOpacity = mkOption {
139
+
Opacity of active windows.
143
+
inactiveOpacity = mkOption {
148
+
Opacity of inactive windows.
152
+
menuOpacity = mkOption {
157
+
Opacity of dropdown and popup menu.
161
+
backend = mkOption {
165
+
Backend to use: <literal>glx</literal> or <literal>xrender</literal>.
172
+
example = "opengl-swc";
174
+
Enable vertical synchronization using the specified method.
175
+
See <literal>compton(1)</literal> man page available methods.
179
+
refreshRate = mkOption {
184
+
Screen refresh rate (0 = automatically detect).
188
+
package = mkOption {
189
+
type = types.package;
190
+
default = pkgs.compton;
191
+
example = literalExample "pkgs.compton";
193
+
Compton derivation to use.
197
+
extraOptions = mkOption {
201
+
unredir-if-possible = true;
205
+
Additional Compton configuration.
210
+
config = mkIf cfg.enable {
211
+
systemd.user.services.compton = {
212
+
description = "Compton composite manager";
213
+
wantedBy = [ "default.target" ];
215
+
ExecStart = "${cfg.package}/bin/compton --config ${configFile}";
217
+
Restart = "always";
219
+
environment.DISPLAY = ":0";
222
+
environment.systemPackages = [ cfg.package ];