A home-manager flake to apply today's wallpaper from bing periodically
README.md

next-bing-wallpaper #

A home-manager module to apply today's wallpaper from bing periodically

Notes #

  • Created this because most of the wallpaper changers are way too fancy for my need: I just want something that simply fetch today's wallpaper and applies to all screens.

Supported Shells #

  • caelestia-shell (shell = "caelestia", the default)
  • DankMaterialShell (shell = "dms")
  • PRs are welcomed!

Usage #

Step 1: Add inputs #

Add next-bing-wallpaper to your flake inputs:

{
  inputs = {
    next-bing-wallpaper = {
      url = "git+https://tangled.org/itsze.ro/next-bing-wallpaper";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
}

Step 2: Add the Home Manager module #

homeConfigurations.$YOUR_USER = home-manager.lib.homeManagerConfiguration {
  modules = [
    inputs.next-bing-wallpaper.homeManagerModules.default
  ];
};

Step 3: Enable the option #

Somewhere in your home-manager config, add this:

{
  programs.next-bing-wallpaper.enable = true;
}

Step 4: Pick your shell #

Defaults to caelestia-shell. For DankMaterialShell:

{
  programs.next-bing-wallpaper.shell = "dms";
}

Options #

Option Default Description
enable false Install the script and enable the timer.
shell "caelestia" Which shell to apply the wallpaper through: "caelestia" or "dms".
shellCommand null Command used to talk to the shell. Defaults to caelestia-shell or dms off PATH; set an absolute path when the shell isn't on the user service's PATH.
package built for shell The next-bing-wallpaper package to use.
onBootSec "1m" How long after boot to fetch the first wallpaper.
onUnitActiveSec "2h" How often to check for a new wallpaper afterwards.

How it works #

When enabled, the module:

  1. Installs the next-bing-wallpaper script
  2. Creates a systemd user service that runs the script, and a timer that triggers it after boot and periodically thereafter

The wallpaper is saved to ~/.bingwp.jpg and applied via a shell specific command.

A note on cache-busting #

Neither shell reloads a wallpaper whose path hasn't changed, so each one needs a different nudge:

  • caelestia is handed the same path twice, the first with a 1 appended. The bogus path is enough to make the real one register as a change.
  • DMS ignores that trick, since it bails on an unchanged path in two places (an early return in WallpaperBackground.qml, and cache: true on the Image). Instead it gets a genuinely new path per image, under ~/.cache/next-bing-wallpaper/, named after a hash of the Bing URL. Older files there are pruned on each run. A re-run that finds the same image reuses the same path and so doesn't reload, which is what we want.