Skip to content

Commit

Permalink
feat(nix): add waypaper module
Browse files Browse the repository at this point in the history
  • Loading branch information
sbulav committed Aug 13, 2024
1 parent 991c169 commit d7fb7f7
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 4 deletions.
5 changes: 5 additions & 0 deletions nix/homes/x86_64-linux/sab@nz/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ in {
hyprlock = disabled;
wezterm = enabled;
wallpaper = "${wallpapers}/share/wallpapers/catppuccin/bench.png";

waypaper = {
enable = true;
wallpaperDirectory = "${wallpapers}/share/wallpapers";
};
};
};

Expand Down
56 changes: 56 additions & 0 deletions nix/modules/home/desktop/addons/waypaper/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
lib,
config,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
mkOption
types
;

cfg = config.custom.desktop.addons.waypaper;
in {
options.custom.desktop.addons.waypaper = {
enable = mkEnableOption "Waypaper app to change wallpapers";
wallpaperDirectory = mkOption {
type = with types; either path str;
default = config.xdg.userDirs.pictures;
apply = toString; # Prevent copies to Nix store.
description = ''
The directory where waypaper reads wallpapers from.
If [](#opt-xdg.userDirs.enable) is
`true` then the defined XDG pictures directory is used.
Otherwise, you must explicitly specify a value.
'';
};
};

config = mkIf cfg.enable {
home.packages = with pkgs; [
custom.waypaper
];
xdg.configFile."waypaper/config.ini".text = ''
[Settings]
language = en
folder = ${cfg.wallpaperDirectory}
backend = hyprpaper
monitors = All
fill = Fill
sort = name
color = #ffffff
subfolders = True
number_of_columns = 3
post_command =
wallpaper = ${cfg.wallpaperDirectory}/catpuccin/lantern.png
swww_transition_type = any
swww_transition_step = 90
swww_transition_angle = 0
swww_transition_duration = 1
'';
};
}
2 changes: 0 additions & 2 deletions nix/modules/nixos/desktop/addons/hyprland-utils/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ in {
adwaita-qt6
adwaita-icon-theme
gnome-tweaks
# inputs.nixpkgs-philippheuer.packages.${pkgs.system}.waypaper # wallpaper manager
pkgs.custom.waypaper
];

environment.sessionVariables = {
Expand Down
5 changes: 3 additions & 2 deletions nix/packages/waypaper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ python3.pkgs.buildPythonApplication rec {
changelog = "https://github.com/anufrievroman/waypaper/releases/tag/${version}";
description = "GUI wallpaper setter for Wayland-based window managers";
longDescription = ''
GUI wallpaper setter for Wayland-based window managers that works as a frontend for popular backends like swaybg and swww.
GUI wallpaper setter for Wayland-based window managers that works as a
frontend for popular backends like hyprpaper, swaybg and swww.
If wallpaper does not change, make sure that swaybg or swww is installed.
If wallpaper does not change, make sure that IPC is enabled;
'';
homepage = "https://github.com/anufrievroman/waypaper";
license = licenses.gpl3Only;
Expand Down

0 comments on commit d7fb7f7

Please sign in to comment.