mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-06 17:11:03 +01:00
jankyborders: add module (#6677)
This commit is contained in:
parent
94ea2cb536
commit
63e77d09a1
6 changed files with 122 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
83
modules/services/jankyborders.nix
Normal file
83
modules/services/jankyborders.nix
Normal 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[@]}"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -111,6 +111,7 @@ let
|
|||
"hyfetch"
|
||||
"i3status"
|
||||
"irssi"
|
||||
"jankyborders"
|
||||
"jujutsu"
|
||||
"joplin-desktop"
|
||||
"jqp"
|
||||
|
|
@ -418,6 +419,7 @@ in import nmtSrc {
|
|||
./modules/services/espanso-darwin
|
||||
./modules/services/git-sync-darwin
|
||||
./modules/services/imapnotify-darwin
|
||||
./modules/services/jankyborders
|
||||
./modules/services/nix-gc-darwin
|
||||
./modules/services/macos-remap-keys
|
||||
./modules/services/ollama/darwin
|
||||
|
|
|
|||
26
tests/modules/services/jankyborders/config.nix
Normal file
26
tests/modules/services/jankyborders/config.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{ pkgs, ... }: {
|
||||
services.jankyborders = {
|
||||
enable = true;
|
||||
settings = {
|
||||
active_color = "0xffe2e2e3";
|
||||
hidpi = "off";
|
||||
inactive_color = "0xff414550";
|
||||
style = "round";
|
||||
width = 6.0;
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
configFile=home-files/.config/borders/bordersrc
|
||||
assertFileExists $configFile
|
||||
assertFileIsExecutable "$configFile"
|
||||
# assertFileContent $configFile ${./jankyborders-config-expected}
|
||||
assertFileContent "$configFile" ${
|
||||
pkgs.writeShellScript "bordersrc"
|
||||
(builtins.readFile ./jankyborders-config-expected)
|
||||
}
|
||||
|
||||
serviceFile=LaunchAgents/org.nix-community.home.jankyborders.plist
|
||||
assertFileExists "$serviceFile"
|
||||
'';
|
||||
}
|
||||
1
tests/modules/services/jankyborders/default.nix
Normal file
1
tests/modules/services/jankyborders/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ jankyborders-basic-config = ./config.nix; }
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
options=(
|
||||
active_color=0xffe2e2e3
|
||||
hidpi=off
|
||||
inactive_color=0xff414550
|
||||
style=round
|
||||
width=6.000000
|
||||
)
|
||||
|
||||
@JankyBorders@/bin/borders "${options[@]}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue