Oscillating thick-liquid jets have been proposed to create pockets to provide neutron shielding and droplet clearing at high repetition rate for heavy-ion inertial fusion energy. A procedure is introduced to compute nonsinusoidal nozzle oscillation functions based on the desired pocket geometry at the time of target ignition. The primary goals for creating optimum pocket geometries are discussed, such as complete pocket closing at time of target ignition, avoidance of liquid-liquid collisions that could lead to jetting into the target region, maintenance of a uniform void distribution to avoid the propagation of strong shocks toward the injection nozzles, and consideration of mechanical limitations on the maximum nozzle acceleration. The equation of motion for a horizontally translating nozzle is derived that generates the desired pocket shape. Numerical results are compared to a sinusoidal oscillation function. The same procedure had been applied to a rotating nozzle.