57 Commits

Author SHA1 Message Date
Konstantin Pereiaslov
00e6bf811a Cron support 2026-01-05 02:05:54 -06:00
Konstantin Pereiaslov
6be2b875bf Experimental Wayland support 2026-01-02 03:10:57 -06:00
Konstantin Pereiaslov
b858c7c4a7 Turn polling_interval_ms into a constant 2024-01-05 03:15:46 -06:00
Konstantin Pereiaslov
b2c8e2f20b Fix copy-paste error 2024-01-05 03:10:10 -06:00
Konstantin Pereiaslov
bb6d1690fd Fix that SIGINT and SIGTERM received by runwhenindle were sent to the process even in PID mode. 2024-01-05 02:37:26 -06:00
Konstantin Pereiaslov
395d43dc05 Check if PID is running before starting to monitor 2024-01-05 02:23:45 -06:00
Konstantin Pereiaslov
475350b05f Change default pause method to SIGSTOP for compatibility with more programs out of the box. 2024-01-04 00:07:04 -06:00
Konstantin Pereiaslov
dc61e18ba4 Add support of managing an external pid 2024-01-04 00:03:55 -06:00
Konstantin Pereiaslov
f964e64751 Automated code formatting 2024-01-01 22:13:00 -06:00
Konstantin Pereiaslov
a983cb2490 First version of pausing/resuming recursively 2023-10-01 23:14:10 -05:00
Konstantin Pereiaslov
c629c302ad Fix incorrect variable types in debug message strings 2023-09-21 00:27:31 -05:00
Konstantin Pereiaslov
c0ca488f4e Fix that default pause method was undefined 2023-09-05 03:38:08 -05:00
Konstantin Pereiaslov
34f502fb2c Add pause method argument and support SIGSTOP 2023-09-04 21:01:30 -05:00
Konstantin Pereiaslov
dfb2e8aec0 Move newline from fprintf_error to the error messages 2023-09-04 20:38:28 -05:00
Konstantin Pereiaslov
6d7471e17e Fix typo 2023-09-04 01:50:59 -05:00
Konstantin Pereiaslov
b00fce8538 Move argument parsing to a separate file 2023-09-04 01:50:54 -05:00
Konstantin Pereiaslov
7e2725aad1 Move wait_for_pid_to_exit_synchronously and exit_if_pid_has_finished to process_handling.c 2023-09-04 01:37:51 -05:00
Konstantin Pereiaslov
f32da29ab9 Move process handling to a separate source file 2023-09-04 01:27:21 -05:00
Konstantin Pereiaslov
8ba84e47ec Move command line arguments parsing into a separate function 2023-09-04 00:57:28 -05:00
Konstantin Pereiaslov
7c5370ba03 Add start-monitoring-after option, move main check to pause_or_resume_command_depending_on_user_activity, improve help. 2023-09-04 00:51:09 -05:00
Konstantin Pereiaslov
fbebf378e7 Move code comment 2023-09-03 23:48:04 -05:00
Konstantin Pereiaslov
26460aaafa Make command_paused volatile sig_atomic_t 2023-09-03 23:46:50 -05:00
Konstantin Pereiaslov
c6343fe721 Fix error message when using --quiet and --debug 2023-09-03 22:24:12 -05:00
Konstantin Pereiaslov
d29b649b07 Implement handling the interruption signals: pass them to the underlying command and stop the idle checks 2023-09-03 21:26:40 -05:00
Konstantin Pereiaslov
d85a6c3e11 More debug output 2023-09-03 20:29:13 -05:00
Konstantin Pereiaslov
4c7e4b5c80 Fix typo 2023-09-03 20:16:12 -05:00
Konstantin Pereiaslov
3d62c26f8f Add debug output 2023-09-03 20:16:12 -05:00
Konstantin Pereiaslov
42556a508a Fix default values not being defined for verbose and quiet variables. 2023-08-31 04:55:40 -05:00
Konstantin Pereiaslov
a9604fce1f Rework error messages printing function and make more error messages red 2023-06-29 00:21:45 -05:00
Konstantin Pereiaslov
8421817c82 Make error messages red 2023-06-28 23:55:49 -05:00
Konstantin Pereiaslov
75d1a2135f Check that X and XScreensaver are available and if not, run the command without pausing it. 2023-06-28 23:55:49 -05:00
Konstantin Pereiaslov
465efe02ad Fix type of sleep_time_ms in fprintf 2023-05-28 20:03:10 -05:00
Konstantin Pereiaslov
fc39ce1407 declare a scope around "t" argument handling to have declared constants and variables work properly. 2023-05-28 19:24:50 -05:00
Konstantin Pereiaslov
1d57e216ec Remove unnecessary code for removing quotes, getopt already removes the quotes. 2023-05-28 19:19:59 -05:00
Konstantin Pereiaslov
9344aa4e4e Add --version argument 2023-05-28 18:54:06 -05:00
Konstantin Pereiaslov
c62dc47f68 Free memory used for storing shell command string once it's no longer needed. 2023-05-28 02:53:02 -05:00
Konstantin Pereiaslov
e3e90723b1 After encountering first unknown argument start treating the remaining arguments as command to be run.
This allows to not add quotes for the command that needs to be run.
2023-05-28 02:37:28 -05:00
Konstantin Pereiaslov
56d6a6e7f4 Fix possible overflow in timeout parameter 2023-05-20 01:36:54 -05:00
Konstantin Pereiaslov
592c4e239f Account for the time it took to pause the command when calculating how long to sleep for.
Possibly unnecessary as this always seems to be 0 on my machine.
2023-05-20 00:40:08 -05:00
Konstantin Pereiaslov
6347fe4ca3 Remove trailing dots in messages 2023-05-19 23:43:13 -05:00
Konstantin Pereiaslov
55bdd5c625 Automated code formatting 2023-05-19 23:40:54 -05:00
Konstantin Pereiaslov
79296a81f0 Change idle time comparison to >= instead of > to avoid an extra sleep when idle time matches the timeout exactly. 2023-05-19 23:40:30 -05:00
Konstantin Pereiaslov
8b76c78cce Change polling to use nanosleep and calculate sleep times in ms.
Also fixed the calculation of time to sleep when user is active to not subtract the polling interval and changed idle time comparison to be >= instead of >.
These changes get rid of an extra activity checks before resuming the process and also allow more precise sleep timing.
2023-05-19 23:39:16 -05:00
Konstantin Pereiaslov
482fb66e54 Make commands that fail, fail faster and move first idle check before first sleep, but after an initial 300ms sleep 2023-05-19 22:56:35 -05:00
Konstantin Pereiaslov
83c82b352e Display the command that was started 2023-05-19 22:56:35 -05:00
Konstantin Pereiaslov
3fff3d3cab Handle all kill errors 2023-05-19 22:56:35 -05:00
Konstantin Pereiaslov
f4d7013af8 Automated code formatting 2023-05-19 22:56:35 -05:00
Konstantin Pereiaslov
796adc6b1d Make verbose and quiet global variables 2023-05-19 22:56:35 -05:00
Konstantin Pereiaslov
6ccd592420 Open display before running the command so that it doesn't start execution in case X is not available. 2023-05-15 21:45:59 -05:00
Konstantin Pereiaslov
890cdb4958 Fix -t argument treating its value as milliseconds rather than seconds. 2023-05-15 02:41:16 -05:00