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

Setting output config by name after it has been set by identifier doesn't work on sway startup but does on reload #5632

Open
pedrocr opened this issue Aug 19, 2020 · 3 comments · May be fixed by #5629
Labels
bug Not working as intended

Comments

@pedrocr
Copy link
Contributor

pedrocr commented Aug 19, 2020

Please fill out the following:

output "Goldstar Company Ltd LG HDR 4K 0x0000333A" mode 3840x2160
output DP-1 mode 1920x1080@60hz

The identifier is for the monitor attached to the DP-1 output.

  • Description: Adjusting the output mode of the connection after the identifier doesn't work on sway startup. If I then do a reload of the config the correct mode is applied.
@pedrocr pedrocr added the bug Not working as intended label Aug 19, 2020
pedrocr added a commit to pedrocr/sway that referenced this issue Aug 19, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
@pedrocr pedrocr linked a pull request Aug 19, 2020 that will close this issue
pedrocr added a commit to pedrocr/sway that referenced this issue Aug 19, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue Sep 2, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue Sep 2, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue Sep 2, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue Sep 2, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue Sep 2, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue Sep 6, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue Sep 6, 2020
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue May 18, 2021
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
pedrocr added a commit to pedrocr/sway that referenced this issue May 19, 2021
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
WhyNotHugo pushed a commit to WhyNotHugo/sway that referenced this issue Dec 1, 2021
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
WhyNotHugo pushed a commit to WhyNotHugo/sway that referenced this issue Dec 1, 2021
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
@WhyNotHugo
Copy link
Contributor

sway/sway/config/output.c

Lines 698 to 700 in 02b412a

// Try to find the output container and apply configuration now. If
// this is during startup then there will be no container and config
// will be applied during normal "new output" event from wlroots.

This comment indicates that during startup, the output don't exist -- which is true as per my testing; during initial config load, WL-1 is not present, but it does show up during reloads.

The comment also indicates that during startup, the "new output event" should apply the config. I dug down through that, and found the cause of this issue: get_output_config has a fixed order of precedence, and identifier always gets priority (this is even clarified in a comment, so it's likely by design?).

There's then three ways to fix the issue at hand:

  • The fix in a single commit from Allow all glob patterns in output configs #5629. This one is a bit too complex, but works. If it sounds okay, I can open a PR with just that.
  • Respecting the original order in get_output_config. This is likely less invasive, and can be done by just refactoring that single function (I'm assuming the items in the list match the original order).
  • When reloading config, apply the same rule, and have the rule using an identifier always take precedence. This is probably the trickiest approach, but would match what seems to be a deliberate choice in get_output_config.

@emersion
Copy link
Member

emersion commented Dec 3, 2021

I'm assuming the items in the list match the original order

I don't think this is the case? If you configure "DP-1", then configure "BenQ EL2870U F8K02862SL0" (same output), then configure "DP-1" again, I think the last configure will update the first item in the list?

@WhyNotHugo
Copy link
Contributor

Ah, I hadn't though of that scenario.

I guess that means that respecting the order of entries (when one uses an identifier and another a name) in the config file would require a large refactor than expected, and, as per this comment, it seems that's not the intended behaviour by design anyway.

I guess this narrows down the options to:

  1. The approach taken in this commit: ac4f6ed. It works, but I fear it might add complexity.
  2. When reloading config, have the rule using an identifier always take precedence. This is probably the trickiest approach, but would match what seems to be a deliberate choice mentioned above. But the gist of it is: when doing a reload merely update the config->output_configs objects, and after having parsed the entire file, call apply_output_config for each output -- which end up being very similar to what happens during startup.

I'd also like to address this in a way that paves the road for #6410, and I think the second approach might make that a bit easier.


Just to be clear though, the current implementation means that if I've set up output "Ancor Communications Inc..." scale 1.5 and then run output * scale 1, the former output is not affected by the wildcard, since the per-name config always supersedes it.

WhyNotHugo pushed a commit to WhyNotHugo/sway that referenced this issue Jul 1, 2022
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
WhyNotHugo pushed a commit to WhyNotHugo/sway that referenced this issue Jul 1, 2022
Instead of doing merges of output configs in several places just keep a
list of all config changes and apply them in order when needed.

Fixes swaywm#5632
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

Successfully merging a pull request may close this issue.

3 participants