1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-27 12:41:02 +01:00

flameshot: add settings option

This commit is contained in:
Robert Helgesson 2021-10-11 21:41:49 +02:00
parent 32285d8fe6
commit 0b47ded208
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
5 changed files with 77 additions and 1 deletions

View file

@ -5,12 +5,35 @@ with lib;
let
cfg = config.services.flameshot;
package = pkgs.flameshot;
iniFormat = pkgs.formats.ini { };
iniFile = iniFormat.generate "flameshot.ini" cfg.settings;
in {
meta.maintainers = [ maintainers.hamhut1066 ];
options = { services.flameshot = { enable = mkEnableOption "Flameshot"; }; };
options.services.flameshot = {
enable = mkEnableOption "Flameshot";
settings = mkOption {
type = iniFormat.type;
default = { };
example = {
General = {
disabledTrayIcon = true;
showStartupLaunchMessage = false;
};
};
description = ''
Configuration to use for Flameshot. See
<link xlink:href="https://github.com/flameshot-org/flameshot/blob/master/flameshot.example.ini"/>
for available options.
'';
};
};
config = mkIf cfg.enable {
assertions = [
@ -20,12 +43,17 @@ in {
home.packages = [ package ];
xdg.configFile = mkIf (cfg.settings != { }) {
"flameshot/flameshot.ini".source = iniFile;
};
systemd.user.services.flameshot = {
Unit = {
Description = "Flameshot screenshot tool";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers = mkIf (cfg.settings != { }) [ "${iniFile}" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };