Files
newznab-tmux/app/Services/Tmux/Scripts/showsleep.php
T
2025-11-01 16:26:59 +01:00

26 lines
542 B
PHP

<?php
/**
* Sleep display script for tmux panes
* Shows a countdown timer in the pane
*/
$sleepTime = (int) ($argv[1] ?? 60);
if ($sleepTime <= 0) {
exit(0);
}
$endTime = time() + $sleepTime;
while (time() < $endTime) {
$remaining = $endTime - time();
$hours = floor($remaining / 3600);
$minutes = floor(($remaining % 3600) / 60);
$seconds = $remaining % 60;
printf("\r⏳ Sleeping: %02d:%02d:%02d remaining", $hours, $minutes, $seconds);
sleep(1);
}
echo "\r✅ Sleep complete".str_repeat(' ', 30)."\n";