aboutsummaryrefslogtreecommitdiff
path: root/modules/services/flameshot.nix
blob: c8659d51d1e56e6b97d54152424867099912baf3 (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
{ config, lib, pkgs, ... }:

with lib;

let

  cfg = config.services.flameshot;
  package = pkgs.flameshot;

in {
  meta.maintainers = [ maintainers.hamhut1066 ];

  options = { services.flameshot = { enable = mkEnableOption "Flameshot"; }; };

  config = mkIf cfg.enable {
    home.packages = [ package ];

    systemd.user.services.flameshot = {
      Unit = {
        Description = "Flameshot screenshot tool";
        After = [
          "graphical-session-pre.target"
          "polybar.service"
          "stalonetray.service"
          "taffybar.service"
        ];
        PartOf = [ "graphical-session.target" ];
      };

      Install = { WantedBy = [ "graphical-session.target" ]; };

      Service = {
        Environment = "PATH=${config.home.profileDirectory}/bin";
        ExecStart = "${package}/bin/flameshot";
        Restart = "on-abort";
      };
    };
  };
}