1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-06 09:01:04 +01:00

jankyborders: add module (#6677)

This commit is contained in:
Austin Horstman 2025-03-22 14:02:25 -05:00 committed by GitHub
parent 94ea2cb536
commit 63e77d09a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 122 additions and 0 deletions

View file

@ -341,6 +341,7 @@ let
./services/hyprpaper.nix
./services/hyprpolkitagent.nix
./services/imapnotify.nix
./services/jankyborders.nix
./services/kanshi.nix
./services/kbfs.nix
./services/kdeconnect.nix

View file

@ -0,0 +1,83 @@
{ config, lib, pkgs, ... }:
let cfg = config.services.jankyborders;
in {
meta.maintainers = [ lib.maintainers.khaneliman ];
options.services.jankyborders = {
enable = lib.mkEnableOption "jankyborders";
package = lib.mkPackageOption pkgs "jankyborders" { };
errorLogFile = lib.mkOption {
type = with lib.types; nullOr (either path str);
defaultText = lib.literalExpression
"\${config.home.homeDirectory}/Library/Logs/jankyborders/err.log";
example = "/Users/khaneliman/Library/Logs/jankyborders.log";
description = "Absolute path to log all stderr output.";
};
outLogFile = lib.mkOption {
type = with lib.types; nullOr (either path str);
defaultText = lib.literalExpression
"\${config.home.homeDirectory}/Library/Logs/jankyborders/out.log";
example = "/Users/khaneliman/Library/Logs/jankyborders.log";
description = "Absolute path to log all stdout output.";
};
settings = lib.mkOption {
type = with lib.types; attrsOf anything;
default = { };
example = lib.literalExpression ''
{
style=round;
width=6.0;
hidpi="off";
active_color="0xffe2e2e3";
inactive_color="0xff414550";
}
'';
description = ''
Configuration settings to passed to `borders` in
{file}`$XDG_CONFIG_HOME/borders/bordersc`. See
<https://github.com/FelixKratz/JankyBorders>
for the documentation.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.jankyborders" pkgs
lib.platforms.darwin)
];
home.packages = [ cfg.package ];
launchd.agents.jankyborders = {
enable = true;
config = {
ProgramArguments = [ (lib.getExe cfg.package) ];
ProcessType = "Interactive";
KeepAlive = true;
RunAtLoad = true;
StandardErrorPath = cfg.errorLogFile;
StandardOutPath = cfg.outLogFile;
};
};
services.jankyborders = {
errorLogFile = lib.mkOptionDefault
"${config.home.homeDirectory}/Library/Logs/borders/borders.err.log";
outLogFile = lib.mkOptionDefault
"${config.home.homeDirectory}/Library/Logs/borders/borders.out.log";
};
xdg.configFile."borders/bordersrc".source =
pkgs.writeShellScript "bordersrc" ''
options=(
${lib.generators.toKeyValue { indent = " "; } cfg.settings})
${lib.getExe cfg.package} "''${options[@]}"
'';
};
}