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:
parent
32285d8fe6
commit
0b47ded208
5 changed files with 77 additions and 1 deletions
|
|
@ -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" ]; };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue