Hyprland: automatic background change
This commit is contained in:
parent
91fb78e143
commit
19e12e6605
4 changed files with 43 additions and 1 deletions
|
|
@ -147,6 +147,7 @@
|
||||||
../../modules/hm/update_background.nix
|
../../modules/hm/update_background.nix
|
||||||
../../modules/hm/vim.nix
|
../../modules/hm/vim.nix
|
||||||
../../modules/hm/webapp.nix
|
../../modules/hm/webapp.nix
|
||||||
|
../../modules/hm/wl_update_background.nix
|
||||||
../../modules/hm/xidlehook.nix
|
../../modules/hm/xidlehook.nix
|
||||||
../../modules/hm/xresources.nix
|
../../modules/hm/xresources.nix
|
||||||
../../modules/hm/zathura.nix
|
../../modules/hm/zathura.nix
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,7 @@
|
||||||
../../modules/hm/update_background.nix
|
../../modules/hm/update_background.nix
|
||||||
../../modules/hm/vim.nix
|
../../modules/hm/vim.nix
|
||||||
../../modules/hm/webapp.nix
|
../../modules/hm/webapp.nix
|
||||||
|
../../modules/hm/wl_update_background.nix
|
||||||
../../modules/hm/xidlehook.nix
|
../../modules/hm/xidlehook.nix
|
||||||
../../modules/hm/xresources.nix
|
../../modules/hm/xresources.nix
|
||||||
../../modules/hm/zathura.nix
|
../../modules/hm/zathura.nix
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
||||||
|
|
||||||
# Execute your favorite apps at launch
|
# Execute your favorite apps at launch
|
||||||
exec-once = waybar & swww init & blueman-applet & nm-applet # & firefox
|
exec-once = waybar & swww init & blueman-applet & nm-applet & systemctl --user restart swayidle # & firefox
|
||||||
|
|
||||||
# Source a file (multi-file configs)
|
# Source a file (multi-file configs)
|
||||||
# source = ~/.config/hypr/myColors.conf
|
# source = ~/.config/hypr/myColors.conf
|
||||||
|
|
|
||||||
40
modules/hm/wl_update_background.nix
Normal file
40
modules/hm/wl_update_background.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
update_time = "10m";
|
||||||
|
backgrounds_directory = "$HOME/Immagini/Sfondi/1080+/1440+";
|
||||||
|
update_script = pkgs.writeShellScriptBin "wl-update-background" ''
|
||||||
|
set -e
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
image=`${pkgs.findutils}/bin/find ${backgrounds_directory} -type f | ${pkgs.gnugrep}/bin/grep -v "/\." | ${pkgs.coreutils}/bin/shuf -n 1`
|
||||||
|
else
|
||||||
|
image="$1"
|
||||||
|
fi
|
||||||
|
echo "image: $image"
|
||||||
|
${pkgs.swww}/bin/swww img "$image"
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home.packages = [ update_script ];
|
||||||
|
|
||||||
|
systemd.user.services."wl-update-background" = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Set random desktop background using swww";
|
||||||
|
After = [ "graphical-session.pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
RequiresMountsFor = [ "/home/bertof/Immagini" ];
|
||||||
|
};
|
||||||
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||||
|
Service = {
|
||||||
|
Type = "oneshot";
|
||||||
|
IOSchedulingClass = "idle";
|
||||||
|
ExecStart = "${update_script}/bin/wl-update-background";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.timers."wl-update-background" = {
|
||||||
|
Unit = { Description = "Set random desktop background using swww"; };
|
||||||
|
Timer = { OnUnitActiveSec = update_time; };
|
||||||
|
Install = { WantedBy = [ "timers.target" ]; };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue