flakes: Migrate the config and miku to flakes
This commit is contained in:
45
lib/helpers/kanshi.nix
Normal file
45
lib/helpers/kanshi.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
mkWallpaperScript = { pkgs, config }: let
|
||||
wallpapers = "/home/${config.ptw.system.singleUser}/Data/Wallpaper";
|
||||
wallpapersHorizontal = "${wallpapers}/horizontal";
|
||||
wallpapersVertical = "${wallpapers}/vertical";
|
||||
in pkgs.writeShellScript "wallpaper.sh" ''
|
||||
set -x
|
||||
[[ $# -lt 1 ]] && echo "No profile specified" && exit 1
|
||||
|
||||
random_file() {
|
||||
find "$1" -maxdepth 1 -type f | shuf -n 1
|
||||
}
|
||||
|
||||
setbg() {
|
||||
# Sets the background of $1 to $2
|
||||
swaymsg "output \"$1\" background $2 fill"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
homeMultihead)
|
||||
horiz=$(random_file ${wallpapersHorizontal})
|
||||
vert=$(random_file ${wallpapersVertical})
|
||||
|
||||
setbg "DP-2" $horiz
|
||||
setbg "HDMI-A-3" $vert
|
||||
;;
|
||||
genericMultihead)
|
||||
horiz1=$(random_file ${wallpapersHorizontal})
|
||||
horiz2=$(random_file ${wallpapersHorizontal})
|
||||
|
||||
setbg "eDP-1" $horiz1
|
||||
setbg "HDMI-A-1" $horiz2
|
||||
;;
|
||||
laptop)
|
||||
horiz=$(random_file ${wallpapersHorizontal})
|
||||
|
||||
setbg "eDP-1" $horiz
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
mkProfile = { script, name, outputs }: {
|
||||
outputs = outputs;
|
||||
exec = "${script} ${name}";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user