~emersion/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH kanshi] Attempt switching all profiles with the same name

Details
Message ID
<20240502013507.275841-1-me@tomlebreux.com>
DKIM signature
pass
Download raw message
Patch: +10 -5
---
For example, if I have the following profiles:

profile "lid-opened" {
	output eDP-1 enable mode 1920x1080 position 0,0 scale 1
	output "screen2" enable
}

profile "lid-opened" {
	output eDP-1 enable mode 1920x1080 position 0,0 scale 1.6
	output "screen3" enable
}

with a sway bindswitch on lid-opened whenever the lid open, we should try all
profiles until one matches. Otherwise, it will fail to switch to
lid-opened if I'm connected to screen3.

 ipc.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/ipc.c b/ipc.c
index f8242215ff1d..fe61f63d929b 100644
--- a/ipc.c
+++ b/ipc.c
@@ -48,18 +48,23 @@ static long handle_switch(VarlinkService *service, VarlinkCall *call,

	struct kanshi_profile *profile;
	bool found = false;
	bool matched = false;
	wl_list_for_each(profile, &state->config->profiles, link) {
		if (strcmp(profile->name, profile_name) == 0) {
			found = true;
		if (strcmp(profile->name, profile_name) != 0) {
			continue;
		}

		found = true;
		if (kanshi_switch(state, profile, apply_profile_done, call)) {
			matched = true;
			break;
		}
	}
	if (!found) {
		return reply_error(call, "fr.emersion.kanshi.ProfileNotFound");
	}

	if (!kanshi_switch(state, profile, apply_profile_done, call)) {
		return reply_error(call, "fr.emersion.kanshi.ProfileNotMatched");
	if (!matched) {
			return reply_error(call, "fr.emersion.kanshi.ProfileNotMatched");
	}

	return 0;
-- 
2.44.0

[kanshi/patches/.build.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D0YRUIL8240I.1ZETO2EE6TNH9@fra01>
In-Reply-To
<20240502013507.275841-1-me@tomlebreux.com> (view parent)
DKIM signature
missing
Download raw message
kanshi/patches/.build.yml: SUCCESS in 36s

[Attempt switching all profiles with the same name][0] from [Tom Lebreux][1]

[0]: https://lists.sr.ht/~emersion/public-inbox/patches/51512
[1]: me@tomlebreux.com

✓ #1210152 SUCCESS kanshi/patches/.build.yml https://builds.sr.ht/~emersion/job/1210152
Details
Message ID
<ENNtMEqWoKK7BTWygzdxkcR3bwqsdQzKvIKtirt-yOEUuuAroulHvVB3_9XoZOCLsFW77W4DgFbvZzhiqcrtatj4t9IzZXRB7HHRN9tSXD0=@emersion.fr>
In-Reply-To
<20240502013507.275841-1-me@tomlebreux.com> (view parent)
DKIM signature
pass
Download raw message
Pushed, thanks!
Reply to thread Export thread (mbox)