mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
satty: add satty to program modules
Add satty, a wlroots based screenshot annotation tool, to the programs module.
This commit is contained in:
parent
589efcf9c0
commit
8af2e064f9
6 changed files with 119 additions and 0 deletions
12
modules/misc/news/2025/08/2025-08-18_19-37-24.nix
Normal file
12
modules/misc/news/2025/08/2025-08-18_19-37-24.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
time = "2025-08-18T17:37:24+00:00";
|
||||||
|
condition = pkgs.stdenv.hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'programs.satty'
|
||||||
|
|
||||||
|
Satty is a screenshot annotation tool, inspired by Swappy and Flameshot.
|
||||||
|
It can easily integrate with your wlroots based screenshot tool and
|
||||||
|
comes with a simple and functional UI for post-processing your screenshots.
|
||||||
|
'';
|
||||||
|
}
|
||||||
57
modules/programs/satty.nix
Normal file
57
modules/programs/satty.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.programs.satty;
|
||||||
|
|
||||||
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = [ lib.hm.maintainers.gauthsvenkat ];
|
||||||
|
|
||||||
|
options.programs.satty = {
|
||||||
|
enable = lib.mkEnableOption "Satty - Modern Screenshot Annotation";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "satty" { nullable = true; };
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
type = tomlFormat.type;
|
||||||
|
default = { };
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
general = {
|
||||||
|
fullscreen = true;
|
||||||
|
corner-roundness = 12;
|
||||||
|
initial-tool = "brush";
|
||||||
|
output-filename = "/tmp/test-%Y-%m-%d_%H:%M:%S.png";
|
||||||
|
};
|
||||||
|
color-palette = {
|
||||||
|
palette = [ "#00ffff" "#a52a2a" "#dc143c" "#ff1493" "#ffd700" "#008000" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Configuration for Satty written to {file}`$XDG_CONFIG_HOME/satty/config.toml`.
|
||||||
|
|
||||||
|
See the [Satty documentation](https://github.com/gabm/Satty#configuration-file)
|
||||||
|
for available options.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
(lib.hm.assertions.assertPlatform "programs.satty" pkgs lib.platforms.linux)
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
|
||||||
|
xdg.configFile."satty/config.toml" = lib.mkIf (cfg.settings != { }) {
|
||||||
|
source = tomlFormat.generate "satty-config.toml" cfg.settings;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
26
tests/modules/programs/satty/basic-configuration.nix
Normal file
26
tests/modules/programs/satty/basic-configuration.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
programs.satty = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
fullscreen = true;
|
||||||
|
corner-roundness = 12;
|
||||||
|
initial-tool = "brush";
|
||||||
|
output-filename = "/tmp/test.png";
|
||||||
|
};
|
||||||
|
|
||||||
|
font.family = "Roboto";
|
||||||
|
|
||||||
|
color-palette.palette = [ "#00ffff" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script =
|
||||||
|
let
|
||||||
|
configFile = "home-files/.config/satty/config.toml";
|
||||||
|
in
|
||||||
|
''
|
||||||
|
assertFileExists "${configFile}"
|
||||||
|
assertFileContent "${configFile}" ${./expected-config.toml}
|
||||||
|
'';
|
||||||
|
}
|
||||||
6
tests/modules/programs/satty/default.nix
Normal file
6
tests/modules/programs/satty/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||||
|
satty-basic-configuration = ./basic-configuration.nix;
|
||||||
|
satty-empty-configuration = ./empty-settings.nix;
|
||||||
|
}
|
||||||
7
tests/modules/programs/satty/empty-settings.nix
Normal file
7
tests/modules/programs/satty/empty-settings.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
programs.satty.enable = false;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertPathNotExists "home-files/.config/satty"
|
||||||
|
'';
|
||||||
|
}
|
||||||
11
tests/modules/programs/satty/expected-config.toml
Normal file
11
tests/modules/programs/satty/expected-config.toml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
[color-palette]
|
||||||
|
palette = ["#00ffff"]
|
||||||
|
|
||||||
|
[font]
|
||||||
|
family = "Roboto"
|
||||||
|
|
||||||
|
[general]
|
||||||
|
corner-roundness = 12
|
||||||
|
fullscreen = true
|
||||||
|
initial-tool = "brush"
|
||||||
|
output-filename = "/tmp/test.png"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue