1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/tests/services-yabai.nix

29 lines
1,022 B
Nix
Raw Normal View History

2020-05-06 16:21:46 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
yabai = pkgs.runCommand "yabai-0.0.0" {} "mkdir $out";
in
{
services.yabai.enable = true;
services.yabai.package = yabai;
services.yabai.config = { focus_follows_mouse = "autoraise"; };
services.yabai.extraConfig = "yabai -m rule --add app='System Preferences' manage=off";
test = ''
echo >&2 "checking yabai service in ~/Library/LaunchAgents"
grep "org.nixos.yabai" ${config.out}/user/Library/LaunchAgents/org.nixos.yabai.plist
grep "${yabai}/bin/yabai" ${config.out}/user/Library/LaunchAgents/org.nixos.yabai.plist
conf=`sed -En '/<string>-c<\/string>/{n; s/\s+?<\/?string>//g; p;}' \
${config.out}/user/Library/LaunchAgents/org.nixos.yabai.plist`
echo >&2 "checking config in $conf"
grep "yabai -m config focus_follows_mouse autoraise" $conf
grep "yabai -m rule --add app='System Preferences' manage=off" $conf
if [ `cat $conf | wc -l` -eq "2" ]; then echo "yabairc correctly contains 2 lines"; else return 1; fi
2020-05-06 16:21:46 +00:00
'';
}