~emersion/public-inbox

wlr-randr: add an option to toggle output v1 APPLIED

~anb: 1
 add an option to toggle output

 1 files changed, 9 insertions(+), 0 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/26160/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH wlr-randr] add an option to toggle output Export this patch

From: Anbang Wen <anb@papla.net>

The new option "toggle" is a convenient way to invert the power state
of selected output.
---
 main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/main.c b/main.c
index 40795bf..5dc4456 100644
--- a/main.c
+++ b/main.c
@@ -373,6 +373,7 @@ static const struct option long_options[] = {
	{"output", required_argument, 0, 0},
	{"on", no_argument, 0, 0},
	{"off", no_argument, 0, 0},
	{"toggle", no_argument, 0, 0},
	{"mode", required_argument, 0, 0},
	{"preferred", no_argument, 0, 0},
	{"custom-mode", required_argument, 0, 0},
@@ -466,6 +467,13 @@ static bool parse_output_arg(struct randr_head *head,
		head->enabled = true;
	} else if (strcmp(name, "off") == 0) {
		head->enabled = false;
	} else if (strcmp(name, "toggle") == 0) {
		if (head->enabled) {
			head->enabled = false;
		} else {
			fixup_disabled_head(head);
			head->enabled = true;
		}
	} else if (strcmp(name, "mode") == 0) {
		int width, height, refresh;
		if (!parse_mode(value, &width, &height, &refresh)) {
@@ -578,6 +586,7 @@ static const char usage[] =
	"--output <name>\n"
	"  --on\n"
	"  --off\n"
	"  --toggle\n"
	"  --mode|--custom-mode <width>x<height>[@<refresh>Hz]\n"
	"  --preferred\n"
	"  --pos <x>,<y>\n"
-- 
2.32.0
Pushed, thanks!