summaryrefslogtreecommitdiff
path: root/features/user/gui/desktops/niri/default.nix
blob: 6304c665db920128b9ed0ae51b7d603361080153 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{
  config,
  pkgs,
  lib,
  inputs,
  ...
}: let
  cfg = config.features.gui.desktops.niri;
  aes = config.aesthetics;
in {
  imports = [
    inputs.niri.homeModules.niri
    ./keybinds.nix
  ];
  options.features.gui.desktops.niri.enable = lib.mkEnableOption "niri";
  config = lib.mkIf cfg.enable {
    features.gui.desktops.niri.parts = {
      waybar.enable = true;
      fuzzel.enable = true;
      selectors.enable = true;
      swww.enable = true;
      mako.enable = true;
      hyprlock.enable = true;
    };
    programs.niri = {
      enable = true;
      package = inputs.niri.packages.${pkgs.system}.niri-unstable;
      settings = {
        outputs = {
          "Samsung Electric Company SAMSUNG 0x00000001" = {
            enable = true;
            scale = 1.5;
          };
        };
        spawn-at-startup = [
          # Status Bar
          {command = ["waybar"];}

          # Wallpaper Daemon
          {command = ["swww-daemon"];}

          # Allows x apps to be used in wayland.
          {command = ["${lib.getExe pkgs.xwayland-satellite}"];}

          # Logs the clipboard for use in utilities.
          {command = ["${pkgs.wl-clipboard}/bin/wl-paste" "--watch" "${pkgs.cliphist}/bin/cliphist" "store"];}
        ];
        environment = {
          DISPLAY = ":0"; # Important for Xwayland.
        };
        window-rules = [
          {
            geometry-corner-radius = let
              radius = 4.0;
            in {
              top-left = radius;
              top-right = radius;
              bottom-left = radius;
              bottom-right = radius;
            };
            clip-to-geometry = true;
            default-column-width.proportion = 1. / 3.;
          }
          {
            # Prevent Tor from being screen captured.
            matches = [{app-id = "Tor Browser";}];
            block-out-from = "screen-capture";
          }
        ];
        switch-events = {
          lid-close.action.spawn = ["hyprlock"];
        };
        prefer-no-csd = true;
        overview = {
          backdrop-color = "#${aes.scheme.base01}";
        };
        layout = {
          gaps = 14;
          insert-hint.enable = false;
          shadow = {
            enable = true;
            softness = 10;
            spread = 5;
            offset = {
              x = 0;
              y = 0;
            };
          };
          focus-ring = {
            enable = true;
            width = 3;
            active.color = "#${aes.scheme.base09}";
          };
          border = {
            enable = false;
            width = 3;
            inactive.color = "#${aes.scheme.base03}";
            active.color = "#${aes.scheme.base08}";
          };
          struts = {
            # left = -1;
            # right = -1;

            left = 20;
            right = 20;
            top = 20;
            bottom = 20;
          };
          always-center-single-column = false;
          empty-workspace-above-first = true;
        };
        input.keyboard.xkb.options = ''
          caps:escape,
          compose:ins
        '';
        hotkey-overlay.skip-at-startup = true;
        input = {
          touchpad = {
            click-method = "clickfinger";
          };
        };
      };
    };
  };
}