summaryrefslogtreecommitdiff
path: root/common/modules/window_managers/dwm/picom.nix
blob: f0b8d1764f184d1ba5e6c8cd1e160b551d1d99e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
homeManager:
{ config, lib, ... }:
let
  cfg = config.beeMods.windowManagers;
in
{
  config = lib.mkIf cfg.enable (
    lib.optionalAttrs homeManager {
      services.picom = {
        enable = true;
        backend = "glx";
        vSync = true;

        activeOpacity = if cfg.window.blur.enable then 0.82 else cfg.window.opacity.active;
        inactiveOpacity = if cfg.window.blur.enable then 0.82 else cfg.window.opacity.inactive;

        opacityRules = [
          "100:fullscreen"
          "100:_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'"
        ];
        settings = {
          blur = {
            method = "dual_kawase";
            strength = cfg.window.blur.strength;
            size = cfg.window.blur.size;
          };
          blur-background = cfg.window.blur.enable;
          blur-background-exclude = [
            "window_type = 'dock'"
            "window_type = 'desktop'"
            "class_g = 'slop'"
            "class_g = 'dwm'"
            "_GTK_FRAME_EXTENTS@"
            "fullscreen"
            "_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'"
          ];

          # xrender-sync-fence = true;
          use-damage = true;

          unredir-if-possible = true;

          detect-transient = true;
          detect-client-opacity = true;
          mark-wmwin-focused = true;
          mark-ovredir-focused = true;
          detect-rounded-corners = true;

          shadow = cfg.shadow;
          fading = false;
          animations = cfg.animations;
        };
      };

      # systemd.user.services.picom.Install.wantedBy = lib.mkForce [ ];
      systemd.user.services.picom = {
        Unit = {
          ConditionEnvironment = "XDG_SESSION_TYPE=x11";
        };
      };
    }
  );
}