Compare commits

..

2 Commits

4 changed files with 25 additions and 16 deletions

View File

@ -12,6 +12,7 @@ top@{ inputs, ... }: {
bingwp = config.packages.bingwp; bingwp = config.packages.bingwp;
screenshot = config.packages.screenshot; screenshot = config.packages.screenshot;
cursors = config.packages.cursors; cursors = config.packages.cursors;
wpd = config.packages.wpd;
}) })
inputs.sal.overlays.default inputs.sal.overlays.default
]; ];

View File

@ -442,20 +442,10 @@ toplevel@{ moduleWithSystem, ... }: {
timers = { rbingwp = { Timer = { OnCalendar = "*-*-* 10:00:00"; Persistent = true; }; Install = { WantedBy = [ "timers.target" ]; }; }; }; timers = { rbingwp = { Timer = { OnCalendar = "*-*-* 10:00:00"; Persistent = true; }; Install = { WantedBy = [ "timers.target" ]; }; }; };
services = { services = {
wpd = { wpd = {
Service = {
Environment = [ "PATH=${pkgs.xdg-user-dirs}/bin:${pkgs.swaybg}/bin" ];
ExecStart = [ "${pkgs.nushell}/bin/nu -c 'swaybg -i ((xdg-user-dir PICTURES) | path split | path join bg.png)'" ];
};
};
bingwp = {
Service = { Type = "oneshot"; Environment = [ "PATH=${pkgs.xdg-user-dirs}/bin:${pkgs.nushell}/bin" ]; ExecStart = [ "${pkgs.bingwp}/bin/bingwp" ]; };
};
rbingwp = {
Install = { WantedBy = [ "sway-session.target" ]; }; Install = { WantedBy = [ "sway-session.target" ]; };
Unit = { Description = "Restart bingwp and wpd services"; After = "graphical-session-pre.target"; PartOf = "graphical-session.target"; }; Unit = { Description = "Switch background every x minutes"; After = "graphical-session-pre.target"; PartOf = "graphical-session.target"; };
Service = { Service = {
Type = "oneshot"; ExecStart = [ "${pkgs.wpd}/bin/wpd" ];
ExecStart = [ "${pkgs.nushell}/bin/nu -c '${pkgs.systemd}/bin/systemctl --user restart bingwp.service; ${pkgs.systemd}/bin/systemctl --user restart wpd.service'" ];
}; };
}; };
}; };

View File

@ -19,7 +19,7 @@ top@{ moduleWithSystem, ... }: {
time.timeZone = "Europe/Prague"; time.timeZone = "Europe/Prague";
fonts.packages = with pkgs; [ (nerdfonts.override { fonts = [ "FiraCode" ]; }) noto-fonts noto-fonts-emoji noto-fonts-lgc-plus ]; fonts.packages = with pkgs; [ (nerdfonts.override { fonts = [ "FiraCode" ]; }) noto-fonts noto-fonts-emoji noto-fonts-lgc-plus ];
environment = { environment = {
systemPackages = with pkgs; [ cmatrix uutils-coreutils cryptsetup fd file git glibc gnumake mlocate moreutils openssh openssl procs ripgrep srm unzip vim zip just ]; systemPackages = with pkgs; [ cmatrix uutils-coreutils-noprefix cryptsetup fd file git glibc gnumake mlocate openssh openssl procs ripgrep srm unzip vim zip just ];
shells = with pkgs; [ zsh nushell ]; shells = with pkgs; [ zsh nushell ];
}; };
programs = { zsh.enable = true; nix-ld.enable = true; dconf.enable = true; }; programs = { zsh.enable = true; nix-ld.enable = true; dconf.enable = true; };

View File

@ -8,9 +8,27 @@ top@{ inputs, ... }: {
lua-ls.enable = true; lua-ls.enable = true;
}; };
}; };
bingwp = pkgs.writers.writeNuBin "bingwp" '' wpd = pkgs.writeShellApplication {
http get "https://pic.idimitrov.dev/latest.png" | save -f ([(xdg-user-dir PICTURES), "bg.png"] | str join "/") name = "wpd";
runtimeInputs = with pkgs; [ swaybg xdg-user-dirs fd uutils-coreutils-noprefix ];
runtimeEnv = { WAYLAND_DISPLAY = "wayland-1"; };
text = ''
random_pic () {
bg_dir="$(xdg-user-dir PICTURES)/bg"
fd . --extension png "$bg_dir" | shuf -n1
}
swaybg -i "$(random_pic)" -m fill &
OLD_PID=$!
while true; do
sleep 60
swaybg -i "$(random_pic)" -m fill &
NEXT_PID=$!
sleep 5
kill -9 $OLD_PID
OLD_PID=$NEXT_PID
done
''; '';
};
screenshot = pkgs.writeShellApplication { screenshot = pkgs.writeShellApplication {
name = "screenshot"; name = "screenshot";
runtimeInputs = with pkgs; [ wl-clipboard xdg-utils ]; runtimeInputs = with pkgs; [ wl-clipboard xdg-utils ];