~ruther/nixos-config

ref: 38ce94f0f3f51277d0772c9995a1dc955f704c0e nixos-config/home/modules/profiles/desktop/qtile/services.nix -rw-r--r-- 7.8 KiB
38ce94f0 — Frantisek Bohacek feat: add dwl iso image 10 months ago
                                                                                
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
{ inputs, config, lib, pkgs, ... }:

let
  mpris-ctl = inputs.self.packages.${pkgs.system}.mpris-ctl;
  sequence-detector = inputs.self.packages.${pkgs.system}.sequence-detector;
in {
  config = lib.mkIf config.profiles.desktop.qtile.enable {

    home.packages = lib.mkMerge [
      (lib.mkIf config.services.dunst.enable [ pkgs.libnotify ])
      [
        mpris-ctl
        sequence-detector
      ]
    ];

    services = {                            # Applets
      network-manager-applet.enable = true; # Network
      blueman-applet.enable = true;
      autorandr.enable = true;

      dunst = {
        enable = true;
        iconTheme = {                                       # Icons
          name = "Papirus Dark";
          package = pkgs.papirus-icon-theme;
          size = "16x16";
        };
        settings = with config.themes.default; {               # Settings
          global = {
            monitor = 0;
            follow = "keyboard";
            # geometry [{width}x{height}][+/-{x}+/-{y}]
            # geometry = "600x50-50+65";
            width = 300;
            height = 200;
            origin = "top-right";
            offset = "50x50";
            shrink = "yes";
            transparency = 10;
            padding = 16;
            gap_size = 5;
            horizontal_padding = 16;
            frame_width = 2;
            frame_color = "#${background.active}";
            separator_color = "frame";
            font = "FiraCode Nerd Font 10";
            line_height = 4;
            idle_threshold = 120;
            markup = "full";
            format = ''<b>%s</b>\n%b'';
            alignment = "left";
            vertical_alignment = "center";
            icon_position = "left";
            word_wrap = "yes";
            ignore_newline = "no";
            show_indicators = "yes";
            sort = true;
            stack_duplicates = true;
            # startup_notification = false;
            hide_duplicate_count = true;
          };
          urgency_low = {                                   # Colors
            background = "#${background.primary}";
            foreground = "#${foreground.text}";
            timeout = 4;
          };
          urgency_normal = {
            background = "#${background.primary}";
            foreground = "#${foreground.text}";
            timeout = 4;
          };
          urgency_critical = {
            background = "#${background.primary}";
            foreground = "#${foreground.text}";
            frame_color = "#${urgent}";
            timeout = 10;
          };
        };
      };

      picom = {
        enable = false;
        package = pkgs.picom;

        backend = "glx";                              # Rendering either with glx or xrender. You'll know if you need to switch this.
        vSync = true;                                 # Should fix screen tearing

        #activeOpacity = 0.93;                         # Node transparency
        #inactiveOpacity = 0.93;
        #menuOpacity = 0.93;

        shadow = false;                               # Shadows
        shadowOpacity = 0.75;
        fade = true;                                  # Fade
        fadeDelta = 10;
        opacityRules = [                              # Opacity rules if transparency is prefered
        #  "100:name = 'Picture in picture'"
        #  "100:name = 'Picture-in-Picture'"
        #  "85:class_i ?= 'rofi'"
          # "90:class_i *= 'discord'"
          # "90:class_i *= 'telegram-desktop'"
          # "90:class_i *= 'emacs'"
          # "90:class_i *= 'Alacritty'"
        #  "100:fullscreen"
        ];                                            # Find with $ xprop | grep "WM_CLASS"

        settings = {
          daemon = true;
          use-damage = false;                         # Fixes flickering and visual bugs with borders
          resize-damage = 1;
          refresh-rate = 0;
          corner-radius = 5;                          # Corners
          round-borders = 5;

          # Extras
          detect-rounded-corners = true;              # Below should fix multiple issues
          detect-client-opacity = false;
          detect-transient = true;
          detect-client-leader = false;
          mark-wmwim-focused = true;
          mark-ovredir-focues = true;
          unredir-if-possible = true;
          glx-no-stencil = true;
          glx-no-rebind-pixmap = true;
        };                                           # Extra options for picom.conf (mostly for pijulius fork)
      };

      redshift = {
        enable = true;
        temperature.night = 3000;
        latitude = 50.2332933;
        longitude = 14.3225926;
      };

      udiskie = {                         # Udiskie wil automatically mount storage devices
        enable = true;
        automount = true;
        tray = "auto";                    # Will only show up in systray when active
      };
    };
    xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source = "${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";

    systemd.user.targets.xorg-wm-services = {
      Unit = {
        Description = "A target that is enabled when starting Qtile";
        Requires = [ "graphical-session.target" "wm-services.target" ];
        PartOf = [ "graphical-session.target" ];
      };
    };

    systemd.user.targets.wm-services = {
      Unit = {
        Description = "A target that is enabled when starting Qtile";
        Requires = [ "graphical-session.target" ];
        PartOf = [ "graphical-session.target" ];
      };
    };

    systemd.user.services = {
      mpris-ctld = {
        Unit = {
          Description = "Daemon for mpris-ctl cli, that will keep track of last playing media";
          PartOf = [ "wm-services.target" ];
        };

        Install = {
          WantedBy = [ "wm-services.target" ];
        };

        Service = {
          ExecStart = "${mpris-ctl}/bin/mpris-ctld";
        };
      };

      network-manager-applet = lib.mkIf config.services.network-manager-applet.enable {
        Unit = {
          After = lib.mkForce [];
          PartOf = lib.mkForce [ "wm-services.target" ];
        };
        Install.WantedBy = lib.mkForce [ "wm-services.target" ];
      };

      blueman-applet = lib.mkIf config.services.network-manager-applet.enable {
        Unit = {
          After = lib.mkForce [];
          PartOf = lib.mkForce [ "wm-services.target" ];
        };
        Install.WantedBy = lib.mkForce [ "wm-services.target" ];
      };

      autorandr = lib.mkIf config.services.autorandr.enable {
        Unit.PartOf = lib.mkForce [ "xorg-wm-services.target" ];
        Install.WantedBy = lib.mkForce [ "xorg-wm-services.target" ];
      };

      dunst = lib.mkIf config.services.dunst.enable {
        Unit = {
          PartOf = lib.mkForce [ "wm-services.target" ];
          After = lib.mkForce [];
        };
        Service = {
          # Remove reference to BusName so dunst is not started under Gnome!
          Type = lib.mkForce "simple";
          BusName = lib.mkForce "empty.dbus.name.placeholder";
        };
        Install = {
          WantedBy = lib.mkForce [ "wm-services.target" ];
        };
      };

      flameshot = lib.mkIf config.services.flameshot.enable {
        Unit = {
          PartOf = lib.mkForce [ "wm-services.target" ];
        };
        Install = {
          WantedBy = lib.mkForce [ "wm-services.target" ];
        };
      };

      picom = lib.mkIf config.services.picom.enable {
        Unit = {
          PartOf = lib.mkForce [ "wm-services.target" ];
        };
        Install = {
          WantedBy = lib.mkForce [ "wm-services.target" ];
        };
      };

      redshift = lib.mkIf config.services.redshift.enable {
        Unit = {
          PartOf = lib.mkForce [ "xorg-wm-services.target" ];
        };
        Install = {
          WantedBy = lib.mkForce [ "wm-services.target" ];
        };
      };
    };
  };
}
Do not follow this link