fix: wallpaper script failed on non pictures in folder

This commit is contained in:
Patrick Großmann 2023-10-16 21:11:53 +02:00
parent c9b93095c0
commit 17594ae15e
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
2 changed files with 12 additions and 4 deletions

View file

@ -1,10 +1,15 @@
{
config,
pkgs,
lib,
...
}: {
# import shared sway config
imports = [../sway3.nix];
systemd.user.services = {
wired.Install.WantedBy = lib.mkForce ["i3-session.target"];
flameshot.Install.WantedBy = lib.mkForce ["i3-session.target"];
};
stylix.targets.i3.enable = true;
xsession.windowManager.i3 = {
enable = true;
@ -12,6 +17,11 @@
startup = [
{command = "xrandr --output DVI-D-0 --mode 1920x1080 --pos 0x0 --rate 60.00 --output DP-4 --mode 2560x1440 --pos 1920x720 --primary --rate 144 --output HDMI-0 --pos 0x1080 --rate 60.00";}
{command = "systemctl --user start set-wallpaper.timer streamdeck.service";}
{
command = "${pkgs.systemd}/bin/systemctl --user import-environment DISPLAY; ${pkgs.systemd}/bin/systemctl --user start i3-session.target";
always = false;
notification = false;
}
];
menu = "rofi -show drun";
keybindings = let

View file

@ -7,7 +7,7 @@
exe =
pkgs.writeShellScript "set-wallpaper"
''
${pkgs.feh}/bin/feh --no-fehbg --bg-fill --randomize --recursive ${wallpaper-folder}/
${pkgs.feh}/bin/feh --no-fehbg --bg-fill --randomize $( ${pkgs.findutils}/bin/find ${wallpaper-folder} | ${pkgs.ripgrep}/bin/rg ".*(\.png|\.jpg)$")
'';
in {
systemd.user = {
@ -15,15 +15,12 @@ in {
set-wallpaper = {
Unit = {
Description = "Set a random wallpaper every 3 minutes";
ConditionEnvironment = "DISPLAY";
};
Timer = {
OnActiveSec = "10 sec";
OnUnitActiveSec = "3 min";
};
Install.WantedBy = [
"timers.target"
"graphical-session.target"
];
};
};
@ -31,6 +28,7 @@ in {
set-wallpaper = {
Unit = {
Description = "Set a random wallpaper on all X displays";
ConditionEnvironment = "DISPLAY";
};
Service = {
Type = "oneshot";