~emersion/public-inbox

chayang: add an option to provide a lock command v1 SUPERSEDED

Ben Collerson: 1
 add an option to provide a lock command

 1 files changed, 19 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/39526/mbox | git am -3
Learn more about email & git

[PATCH chayang] add an option to provide a lock command Export this patch

This is an attempt to make the transition from chayang to swaylock (or
other screenlocker) more transparent. Without the flash of the unlocked
screen between them.

Fixed so chayang will wait for screenlocker to finish.

---
 main.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 4180f69..af54a1f 100644
--- a/main.c
+++ b/main.c
@@ -5,6 +5,8 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

#include <wayland-client.h>
#include <wayland-cursor.h>
@@ -265,8 +267,10 @@ int main(int argc, char *argv[]) {
	wl_list_init(&state.seats);

	double delay_sec = 3;
	char *command = NULL;

	while (1) {
		int opt = getopt(argc, argv, "hd:");
		int opt = getopt(argc, argv, "hc:d:");
		if (opt < 0) {
			break;
		}
@@ -281,6 +285,9 @@ int main(int argc, char *argv[]) {
				return 1;
			}
			break;
		case 'c':;
			command = optarg;
			break;
		default:
			fprintf(stderr, "usage: chayang [-d seconds]\n");
			return opt == 'h' ? 0 : 1;
@@ -352,6 +359,17 @@ int main(int argc, char *argv[]) {
		ret = 2;
	}

	if (command && ret == 0) {
		int status;
		pid_t pid = fork();

		if (pid == 0) {
			execl("/bin/sh", "/bin/sh", "-c", command, NULL);
		}

		waitpid(pid, &status, 0);
	}

	struct chayang_output *output_tmp;
	wl_list_for_each_safe(output, output_tmp, &state.outputs, link) {
		destroy_output(output);
-- 
2.39.2