change wallpaper with systemd 😎

This commit is contained in:
Adithya 2024-04-21 23:00:50 +05:30
parent 928fa4d2ca
commit 96b69f7760
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
3 changed files with 21 additions and 3 deletions

View file

@ -7,5 +7,6 @@
./swayidle.nix
./swaylock.nix
./swww.nix
./wallpaper.nix
];
}

View file

@ -0,0 +1,19 @@
{ config, pkgs, ... }:
let
pictures = "${config.xdg.userDirs.pictures}";
change-wallpaper = "${pkgs.scripts}/bin/chpaper ${pictures}/Wallpapers";
in
{
systemd.user.services.wallpaper = {
Unit = {
Description = "Change Wallpaper";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session-pre.target" ];
Wants = "swww-daemon.service";
};
Service = {
Type = "oneshot";
ExecStart = "${change-wallpaper}";
};
};
}

View file

@ -15,7 +15,6 @@ let
wpctl = "${pkgs.wireplumber}/bin/wpctl";
pictures = "${config.xdg.userDirs.pictures}";
change-wallpaper = "${pkgs.scripts}/bin/chpaper ${pictures}/Wallpapers";
wallhaven-wallpaper = "${pkgs.scripts}/bin/chpaper \$(${pkgs.scripts}/bin/wallhaven ${pictures}/Wallpapers)";
in
{
@ -138,7 +137,6 @@ in
exec-once = [
"${hyprctl} setcursor ${config.gtk.cursorTheme.name} 24"
"${change-wallpaper}"
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
];
@ -171,7 +169,7 @@ in
"SUPER_SHIFT,b, exec, ${pkgs.rofi-bluetooth}/bin/rofi-bluetooth"
"SUPER,escape, exec, ${swaylock} -f -i /tmp/wallpaper.jpg"
"SUPER_SHIFT,W, exec, ${change-wallpaper}"
"SUPER_SHIFT,W, exec, systemctl --user start wallpaper.service"
"SUPER_ALT,W, exec, ${wallhaven-wallpaper}"
"SUPER,1, workspace, 1"