mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-22 11:43:55 -05:00
sway: added default random wallpaper script
This commit is contained in:
parent
5e0b3a3d0e
commit
6416666e29
|
@ -4,6 +4,7 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
imports = [./randomWallpaper.nix];
|
||||||
options = {
|
options = {
|
||||||
alyraffauf.desktop.sway.enable = lib.mkEnableOption "Sway with extra apps.";
|
alyraffauf.desktop.sway.enable = lib.mkEnableOption "Sway with extra apps.";
|
||||||
};
|
};
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
firefox.enable = lib.mkDefault true;
|
firefox.enable = lib.mkDefault true;
|
||||||
kanshi.enable = lib.mkDefault true;
|
kanshi.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
|
desktop.sway.randomWallpaper.enable = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
# Packages that should be installed to the user profile.
|
# Packages that should be installed to the user profile.
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
@ -135,7 +137,6 @@
|
||||||
size = 12.0;
|
size = 12.0;
|
||||||
};
|
};
|
||||||
startup = [
|
startup = [
|
||||||
{command = "${wallpaperd}";}
|
|
||||||
{command = "${pkgs.autotiling}/bin/autotiling";}
|
{command = "${pkgs.autotiling}/bin/autotiling";}
|
||||||
{command = "${notifyd}";}
|
{command = "${notifyd}";}
|
||||||
{command = "${pkgs.wl-clipboard}/bin/wl-paste --type text --watch cliphist store";}
|
{command = "${pkgs.wl-clipboard}/bin/wl-paste --type text --watch cliphist store";}
|
||||||
|
|
33
homeManagerModules/desktop/sway/randomWallpaper.nix
Normal file
33
homeManagerModules/desktop/sway/randomWallpaper.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
sway-randomWallpaper = pkgs.writeShellScriptBin "sway-randomWallpaper" ''
|
||||||
|
directory=${config.home.homeDirectory}/.local/share/backgrounds
|
||||||
|
|
||||||
|
if [ -d "$directory" ]; then
|
||||||
|
while true; do
|
||||||
|
kill `pidof swaybg`
|
||||||
|
random_background=$(ls $directory/*.{png,jpg} | shuf -n 1)
|
||||||
|
${pkgs.swaybg}/bin/swaybg -i $random_background &
|
||||||
|
sleep 300
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
alyraffauf.desktop.sway.randomWallpaper.enable =
|
||||||
|
lib.mkEnableOption "Enable Sway random wallpaper script.";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.alyraffauf.desktop.sway.randomWallpaper.enable {
|
||||||
|
# Packages that should be installed to the user profile.
|
||||||
|
home.packages = with pkgs; [swaybg sway-randomWallpaper];
|
||||||
|
|
||||||
|
wayland.windowManager.sway.config.startup = [
|
||||||
|
{command = "${sway-randomWallpaper}/bin/sway-randomWallpaper";}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue