Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config/output: don't store "id on name" configs #8048

Closed
emersion opened this issue Mar 8, 2024 · 2 comments
Closed

config/output: don't store "id on name" configs #8048

emersion opened this issue Mar 8, 2024 · 2 comments
Labels
enhancement New feature or incremental improvement

Comments

@emersion
Copy link
Member

emersion commented Mar 8, 2024

The user might specify a config for an output by name or by identifier (make/model/serial). When both refer to the same output, we need to merge the configs.

Currently we store the merged config as an "id on name" config. Because of this we need to perform a whole lot of bookeeping to maintain that one up-to-date. It would be way easier to just merge wildcard+name+identifier configs just-in-time when we need it.

The same kind of issue applies to wildcard configs.

@emersion emersion added the enhancement New feature or incremental improvement label Mar 8, 2024
@emersion
Copy link
Member Author

emersion commented Mar 8, 2024

<kennylevinsen> hmm, but wouldn't that mess up with ordering/priority? e.g., if we when applied merge wildcard, then id, then name, then we can have a wildcard config that says "on" but an id config that says "off", and a user confused over why swaymsg output * enable isn't taking effect

@kennylevinsen
Copy link
Member

Maybe we could:

  1. Store both name and identifier records as is.
  2. When retrieving, merge identifier -> name -> wildcard, i.e. most specific has priority.
  3. If storing an identifier config, just store it as is.
  4. If storing an output name config, clear those changes from any matching identifier configs.
  5. If storing a wildcard, clear those changes from all output name and identifier configs.

Clearing the settings from more specific configs ensures the change takes effect without needing an "id_on_name" records.

kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 16, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 16, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 16, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 17, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 19, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 19, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 19, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 19, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 20, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 28, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Mar 28, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
kennylevinsen added a commit to kennylevinsen/sway that referenced this issue Apr 11, 2024
Output configuration can be applied to a particular output in three
ways: As a wildcard, by connector name and by identifier. This in turn
means that three different configurations must be handled at any given
time.

In the current model, this is managed by merging new configuration into
every other matching configuration. At the same time, an additional
synthetic configuration is made which matchehes both identifier and name
at the same time, further complicating logic.

Instead, manage and store each configuration independently and merge
them in order when retrieving configuration for an output. When changes
are made to a less specific configuration, clear these fields from more
specific configurations to allow the change to take effect regardless of
precedence.

Fixes: swaywm#8048
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or incremental improvement
Development

No branches or pull requests

2 participants