1
0
Fork 0
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:
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/hyprpaper.nix
./services/hyprpolkitagent.nix ./services/hyprpolkitagent.nix
./services/imapnotify.nix ./services/imapnotify.nix
./services/jankyborders.nix
./services/kanshi.nix ./services/kanshi.nix
./services/kbfs.nix ./services/kbfs.nix
./services/kdeconnect.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[@]}"
'';
};
}

View file

@ -111,6 +111,7 @@ let
"hyfetch" "hyfetch"
"i3status" "i3status"
"irssi" "irssi"
"jankyborders"
"jujutsu" "jujutsu"
"joplin-desktop" "joplin-desktop"
"jqp" "jqp"
@ -418,6 +419,7 @@ in import nmtSrc {
./modules/services/espanso-darwin ./modules/services/espanso-darwin
./modules/services/git-sync-darwin ./modules/services/git-sync-darwin
./modules/services/imapnotify-darwin ./modules/services/imapnotify-darwin
./modules/services/jankyborders
./modules/services/nix-gc-darwin ./modules/services/nix-gc-darwin
./modules/services/macos-remap-keys ./modules/services/macos-remap-keys
./modules/services/ollama/darwin ./modules/services/ollama/darwin

View 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"
'';
}

View file

@ -0,0 +1 @@
{ jankyborders-basic-config = ./config.nix; }

View file

@ -0,0 +1,9 @@
options=(
active_color=0xffe2e2e3
hidpi=off
inactive_color=0xff414550
style=round
width=6.000000
)
@JankyBorders@/bin/borders "${options[@]}"