mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
26 lines
542 B
PHP
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";
|