Large module update
This commit is contained in:
parent
492ae9d92a
commit
a61bfe3c50
18 changed files with 463 additions and 87 deletions
45
modules/update_background.nix
Normal file
45
modules/update_background.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{ pkgs, config, ... }:
|
||||
let
|
||||
fehCmd = "${pkgs.feh}/bin/feh";
|
||||
backgrounds_directory = ~/Immagini/Sfondi ;
|
||||
update_time = 10;
|
||||
in {
|
||||
home.file.".local/bin/update_background.sh" = {
|
||||
text = ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
image=`find ${backgrounds_directory} -type f | grep -v "/\." | shuf -n 1`
|
||||
${fehCmd} --bg-fill --no-fehbg "$image"
|
||||
'';
|
||||
target = ".local/bin/update_background.sh";
|
||||
executable = true;
|
||||
};
|
||||
|
||||
systemd.user.services."update-background" = {
|
||||
Unit = {
|
||||
Description = "Update the desktop background";
|
||||
After = [ "graphical-session.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
RequiresMountsFor = [ "/home/bertof/Immagini" ];
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${config.home.homeDirectory}/${config.home.file.".local/bin/update_background.sh".target}";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.timers."update-background" = {
|
||||
Unit = {
|
||||
Description="Run update-background every ${toString update_time} minutes";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
Timer = {
|
||||
OnUnitActiveSec="${toString update_time}m";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue