swiftDialog
swiftDialog copied to clipboard
Feature Request: Delayed timer/command file timer
Is your feature request related to a problem? Please describe. There are times where I would like a Dialog window to start timing out, after a certain operation has ended. For example: a Dialog window with a progress bar, that shows the status of certain actions being taken on a system, that ends in a complete state that expects the user to click a button to continue. I would like for that window to time out and proceed after a certain time, but for the timer to not start until all the main actions are complete. This could be because the exact time to complete is unknown.
Describe the solution you'd like There's multiple ways to imagine this, but the two more prominent ones in my mind are:
1. Start the dialog with the timer configured, as you would today, but add an extra flag to delay the timer. For example:
/usr/local/bin/dialog \
--title "Cool Title" \
--message "This is a cool dialog, doing cool things" \
--commandfile "/var/tmp/dialogCommand.log" \
--progress 10 \
--position center \
--hideicon \
--timer 90 \
--hidetimerbar \
--timerdelay
The timer would be configured, but not start (because of --timerdelay
). Later in the script, once we hit "progress step 10", we manually send something like echo "timer: start" >> "/var/tmp/dialogCommand.log"
, which would then start the countdown.
2. Start the dialog with no timer configured, but start one later via the command file This could be something like:
echo "timer: 90" >> "/var/tmp/dialogCommand.log"
echo "timer: hide" >> "/var/tmp/dialogCommand.log"
This solution resembles https://github.com/swiftDialog/swiftDialog/issues/254, but with a (in my opinion) slightly more focussed use-case, compared to the one that was declined.
Personally, I would prefer option 1, but I see value in both.
Describe alternatives you've considered
This can be scripted currently. I think the reason to add it as a built-in feature would be ease of use and consistency, mainly. Shell does not have super elegant timing mechanisms built-in on macOS (things like the timeout
-binary are not standard) and since other languages like perl
and Python
that can do this more readily, are either on their way out, or already removed, this could be a nice addition to the utility itself.
Nice, to be honest tho, I'd be tempted to throw up a mini dialog with a timer (possibly including buttons) to perform that function, although for some that idea might be either a bit much (throwing up another dialog could be "messy"), or just a workaround until an idea like this feature request becomes available.