~emersion/kanshi

eddaeac28ffdc1a263f11c793b99132827a7561f — Simon Ser 2 months ago d832296 master
Fall back to "Unknown" when make/model/serial is unset

Let's be consistent with Sway here [1]. After all, the concept of
this string comes from Sway.

[1]: https://github.com/swaywm/sway/blob/07bfeb2abcb46b5f1472d53963478fa0714fb5b1/sway/config/output.c#L27

References: https://todo.sr.ht/~emersion/kanshi/74
1 files changed, 3 insertions(+), 4 deletions(-)

M main.c
M main.c => main.c +3 -4
@@ 24,11 24,10 @@ static bool try_apply_profiles(struct kanshi_state *state);

static bool match_profile_output(struct kanshi_profile_output *output,
		struct kanshi_head *head) {
	// Assume the field is empty if it's not set.
	const char *make = head->make ? head->make : "";
	const char *model = head->model ? head->model : "";
	const char *make = head->make ? head->make : "Unknown";
	const char *model = head->model ? head->model : "Unknown";
	const char *serial_number =
		head->serial_number ? head->serial_number : "";
		head->serial_number ? head->serial_number : "Unknown";

	char identifier[1024];
	assert(sizeof(identifier) >= strlen(make) + strlen(model) + strlen(serial_number) + 3);