repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

hypr/scripts/autoscroll.nu

Raw
# File: ~/.config/hypr/scripts/autoscroll.nu

# Configuration
let speed = 1000  # millis between scroll events
let scroll_amount = 1  # Number of scroll ticks
let pid_file = $"($env.HOME)/.config/hypr/scripts/autoscroll.pid"

# Check if script is already running
if ($pid_file | path exists) {
  let pid = (open $pid_file | into int)
  try {
    kill $pid
    rm $pid_file
    exit 0
  } catch {
    rm $pid_file  # Remove stale PID file
  }
}

# Save current PID
($nu.pid | into string) | save --force $pid_file

# Infinite scroll loop
loop {
	wtype -d $speed -k Down  # Simulate scroll down via Down arrow key
	sleep 50ms
}