Skip to content

Commit

Permalink
Manage darwin wallpaper with home-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
simonrw committed Jun 4, 2024
1 parent 606ced7 commit efef0ed
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions home/wallpaper.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
{lib, ...}:
with lib; {
{
lib,
isDarwin,
config,
...
}:
with lib; let
wallpaper = config.me.wallpaper;
in {
options.me.wallpaper = mkOption {
type = types.path;
description = "Path to a wallpaper";
};

config = mkIf isDarwin {
# activate the wallpaper
home.activation.setWallpaper = hm.dag.entryAfter ["WriteBoundary"] ''
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"${wallpaper}\" as POSIX file"
'';
};
}

0 comments on commit efef0ed

Please sign in to comment.