picom: remove refreshRate option

Removed by upstream since commit:

    https://github.com/yshui/picom/pull/768/commits/bcbc410c927bf1f7b72b3536911b3c9621ba92fc

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.
This commit is contained in:
Thiago Kenji Okada 2022-04-11 12:32:21 +01:00 committed by Robert Helgesson
parent d49d68f419
commit 7add9ce2e5
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
6 changed files with 102 additions and 24 deletions

View file

@ -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" ];
};
};
};