picom: remove refreshRate option

Removed by upstream since commit:

    bcbc410c92

This commit is included since v9 release:

    https://github.com/yshui/picom/releases/tag/v9
    https://github.com/yshui/picom/releases/tag/v9-rc1 (the actual changelog)

While this doesn't break the config per see, it results in the
following warning in the logs:

    [ DD/MM/YYYY HH:MM:SS.mmm parse_config_libconfig WARN ] The
      refresh-rate option has been deprecated. Please remove it from
      your configuration file. If you encounter any problems without
      this feature, please feel free to open a bug report

Beside the above change we also remove an old workaround and also
write the configuration file to a well-known location in the user's
home directory.
main
Thiago Kenji Okada 2 years ago committed by Robert Helgesson
parent d49d68f419
commit 7add9ce2e5
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
  1. 42
      modules/services/picom.nix
  2. 1
      tests/default.nix
  3. 1
      tests/modules/services/picom/default.nix
  4. 33
      tests/modules/services/picom/picom-basic-configuration-expected.conf
  5. 12
      tests/modules/services/picom/picom-basic-configuration-expected.service
  6. 37
      tests/modules/services/picom/picom-basic-configuration.nix

@ -1,13 +1,14 @@
{ config, lib, pkgs, ... }:
with lib;
with builtins;
let
inherit (builtins) toJSON toString;
inherit (lib)
concatStringsSep elemAt literalExpression mkEnableOption mkIf mkOption
mkRemovedOptionModule optional optionalAttrs optionalString types;
cfg = config.services.picom;
configFile = pkgs.writeText "picom.conf" (optionalString cfg.fade ''
configFile = optionalString cfg.fade ''
# fading
fading = true;
fade-delta = ${toString cfg.fadeDelta};
@ -46,8 +47,7 @@ let
# other options
backend = ${toJSON cfg.backend};
vsync = ${toJSON cfg.vSync};
refresh-rate = ${toString cfg.refreshRate};
'' + cfg.extraOptions);
'' + cfg.extraOptions;
in {
@ -250,15 +250,6 @@ in {
'';
};
refreshRate = mkOption {
type = types.int;
default = 0;
example = 60;
description = ''
Screen refresh rate (0 = automatically detect).
'';
};
package = mkOption {
type = types.package;
default = pkgs.picom;
@ -282,6 +273,11 @@ in {
};
};
imports = [
(mkRemovedOptionModule [ "services" "picom" "refreshRate" ]
"The option `refresh-rate` has been deprecated by upstream.")
];
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.picom" pkgs
@ -290,6 +286,8 @@ in {
home.packages = [ cfg.package ];
xdg.configFile."picom/picom.conf".text = configFile;
systemd.user.services.picom = {
Unit = {
Description = "Picom X11 compositor";
@ -299,17 +297,13 @@ in {
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = let
experimentalBackendsFlag =
if cfg.experimentalBackends then " --experimental-backends" else "";
in {
ExecStart = "${cfg.package}/bin/picom --config ${configFile}"
+ experimentalBackendsFlag;
Service = {
ExecStart = concatStringsSep " " ([
"${cfg.package}/bin/picom"
"--config ${config.xdg.configFile."picom/picom.conf".source}"
] ++ optional cfg.experimentalBackends "--experimental-backends");
Restart = "always";
RestartSec = 3;
} // optionalAttrs (cfg.backend == "glx") {
# Temporarily fixes corrupt colours with Mesa 18.
Environment = [ "allow_rgb10_configs=false" ];
};
};
};

@ -155,6 +155,7 @@ import nmt {
./modules/services/mpd
./modules/services/pantalaimon
./modules/services/pbgopy
./modules/services/picom
./modules/services/playerctld
./modules/services/polybar
./modules/services/redshift-gammastep

@ -0,0 +1 @@
{ picom-basic-configuration = ./picom-basic-configuration.nix; }

@ -0,0 +1,33 @@
# fading
fading = true;
fade-delta = 5;
fade-in-step = 0.04;
fade-out-step = 0.04;
fade-exclude = ["window_type *= 'menu'","name ~= 'Firefox$'","focused = 1"];
# shadows
shadow = true;
shadow-offset-x = -10;
shadow-offset-y = -15;
shadow-opacity = 0.8;
shadow-exclude = ["window_type *= 'menu'","name ~= 'Firefox$'","focused = 1"];
# opacity
active-opacity = 1.0;
inactive-opacity = 1.0;
inactive-dim = 0.0;
opacity-rule = [];
wintypes:
{
dock = { shadow = false; };
dnd = { shadow = false; };
popup_menu = { opacity = 1.0; };
dropdown_menu = { opacity = 1.0; };
};
# other options
backend = "xrender";
vsync = true;
unredir-if-possible = true;
dbe = true;

@ -0,0 +1,12 @@
[Install]
WantedBy=graphical-session.target
[Service]
ExecStart=@picom@/bin/picom --config /nix/store/00000000000000000000000000000000-hm_picompicom.conf --experimental-backends
Restart=always
RestartSec=3
[Unit]
After=graphical-session-pre.target
Description=Picom X11 compositor
PartOf=graphical-session.target

@ -0,0 +1,37 @@
{ config, pkgs, ... }:
{
services.picom = {
enable = true;
fade = true;
fadeDelta = 5;
fadeSteps = [ "0.04" "0.04" ];
fadeExclude =
[ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ];
shadow = true;
shadowOffsets = [ (-10) (-15) ];
shadowOpacity = "0.8";
shadowExclude =
[ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ];
backend = "xrender";
vSync = true;
extraOptions = ''
unredir-if-possible = true;
dbe = true;
'';
experimentalBackends = true;
};
test.stubs.picom = { };
nmt.script = ''
assertFileContent \
home-files/.config/picom/picom.conf \
${./picom-basic-configuration-expected.conf}
serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/picom.service)
assertFileContent \
"$serviceFile" \
${./picom-basic-configuration-expected.service}
'';
}
Loading…
Cancel
Save