~emersion/kanshi

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
Pick lowest delta when fuzzy matching refreshes

If we have a refresh, try to pick something with an exact refresh first.
Doing a fuzzy match initially here can lead us to picking a refresh
such as 120.01 or 60.01, which is problematic for two reasons:
 - Modes such as 4K 120.01Hz is too much for link bandwidth of DP 1.4 without DSC.
 - It becomes out of phase with the majority of content being displayed.

Fixes me not being able to use 4K 120Hz on my monitor with AMDGPU + Radeon VII which supports DP 1.4, but not DSC (Display Stream Compression).

Signed-off-by: Joshua Ashton <joshua@froggi.es>
build: bump version to 1.3.0
build: fix indentation
build: remove unnecessary join_paths invocation
build: stop using sh to invoke scdoc
Update url in man pages
Retry to apply profile immediately if we received done

Should fix https://todo.sr.ht/~emersion/kanshi/70
Clear pending profile

After success/error/cancellation, clear pending_profile so that
apply_profile can try to apply it again.
Improve the make-model-serial matching of outputs

Previously, the matching algorithm was looking for user-configured
output name as a substring in "$output_description ($output_name)". This
lead to unexpected behaviour when you have two outputs where the one's
description is a substring of the other's.

For example, say, you have monitors "hello (DP-1)" and "hello world
(DP-2)" and you're trying to match them in your Kanshi config using

profile {
  output "hello" …
  output "hello world" …
}

Substring matching allows "hello" to be matched with either of the
outputs, and the profile may end up being applied or rejected depending
on the order in which the outputs are discovered: if "hello world
(DP-2)" is discovered first, it gets matched with "hello", while "hello
world" fails to match with "hello (DP-1)".

This patch makes Kanshi discover the actual values of output's make,
model and serial; and then compares the user-supplied matching
string with "$make $model $serial" instead of looking for it in the
description. This is exactly how swaymsg forms the output descriptions
[1], so the user can simply copy-paste the output descriptions from
swaymsg into Kanshi config and have it uniquely identified.

To implement that, this patch takes advantage of the version 2 of
wlr-output-management-unstable-v1.xml protocol.

This patch fixes my issue [2] that I reported (I don't know if it fixes
the issues of others reported there).

[1]: https://github.com/swaywm/sway/blob/master/swaymsg/main.c#L218
[2]: https://todo.sr.ht/~emersion/kanshi/54
Upgrade wlr-output-management-unstable-v1.xml to version 2
readme: finish migration to SourceHut
635d988a — Oğuz Ersen 1 year, 3 months ago
man: fix wrong section headers
92a5a327 — Érico Nogueira 1 year, 4 months ago
Add CI step to test build without varlink.
68f39b97 — Jason Francis 1 year, 4 months ago
Add kanshictl utility.

It can talk to kanshi via the varlink interface. The only command
currently supported is to reload the config.

Co-authored-by: Érico Nogueira <erico.erc@gmail.com>
afab6397 — Jason Francis 1 year, 4 months ago
Add optional varlink interface.

We don't want to fallback to libwayland's defaults, so WAYLAND_DISPLAY
needs to be set in env. Since IPC in the future is going to use
XDG_RUNTIME_DIR, we also require it.

Because these functions will be used in other parts of the code as well,
we rework the build system slightly to accommodate it.

Co-authored-by: Érico Nogueira <erico.erc@gmail.com>
123a2f43 — Jason Francis 1 year, 4 months ago
Add signal handlers to reload the config.

Signaling kanshi with SIGHUP will now reload the config.

Co-authored-by: Érico Nogueira <erico.erc@gmail.com>
bec47f49 — Jason Francis 1 year, 4 months ago
Factor out event loop.

This rework is necessary because it will allow us to add signal handlers
via signalfd and a varlink interface for IPC.

Co-authored-by: Érico Nogueira <erico.erc@gmail.com>
fd565f44 — Mayeul Cantan 1 year, 10 months ago
parser: support single quotation marks

See https://github.com/emersion/kanshi/pull/96

Includes a simplification suggested by:

Co-authored-by: Érico Nogueira Rolim <34201958+ericonr@users.noreply.github.com>
Next