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

Improve output configuration via wlr-output-configuration #7571

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

vaxerski
Copy link
Member

Improves the handling of wlr-output-configuration (e.g. wdisplays, kanshi)

Notable changes:

  • Output configuration will be valid for as long as the client has the global bound (so likely for as long as it's running)
  • Wlr output configuration will no longer be a rule, it will be treated as a hard override of whatever the user sets in the cfg (for as long as point 1)
  • Older clients have precedence (but who runs 2 monitor managers?)

Ref #7059

@leiserfg
Copy link
Contributor

I just built it and now kanshi thinks the internal monitor was disabled, but it is still enabled (fully working not as before the patch when it was disabled but the last frame was still shown). Will try wdisplay.

@leiserfg
Copy link
Contributor

Wdisplay does not work either, I disable the Enabled checkbox and as soon as I click Apply it gets enabled again.

@vaxerski
Copy link
Member Author

log pls

@vaxerski
Copy link
Member Author

oh wait sec

@vaxerski
Copy link
Member Author

now

@leiserfg
Copy link
Contributor

Do you want a log with kanshi, with wdisplay, or both?

@vaxerski
Copy link
Member Author

whichever doesnt work, and explain what doesnt work

@leiserfg
Copy link
Contributor

After e it worked with kanshi, let me play with it a bit more.

@vaxerski
Copy link
Member Author

the power of e

@leiserfg
Copy link
Contributor

leiserfg commented Aug 29, 2024

It disabled the internal monitor correctly, but didn't enable it when I unplugged the external one
hyprland.log

My Kanshi rules are:

profile undocked {
  output "eDP-1" enable scale 1.175000
}

profile docked-left {
  output "DP-3"
  output "eDP-1" disable
}

profile docked-right {
  output "DP-2"
  output "eDP-1" disable
}


the logs of kanshi are:

Aug 29 16:32:54 rahmen systemd[1417]: Started Dynamic output configuration.
Aug 29 16:32:55 rahmen kanshi[952746]: applying profile 'docked-left'
Aug 29 16:32:55 rahmen kanshi[952746]: applying profile output 'DP-3' on connected head 'DP-3'
Aug 29 16:32:55 rahmen kanshi[952746]: applying profile output 'eDP-1' on connected head 'eDP-1'
Aug 29 16:32:55 rahmen kanshi[952746]: configuration for profile 'docked-left' applied
Aug 29 16:33:17 rahmen kanshi[952746]: no profile matched

it seems to me like the internal monitor never gets re-exposed to kanshi.

@leiserfg
Copy link
Contributor

I did sleep 5 && hyprctl monitors and disconnected the external monitor and got unknown request.

@vaxerski
Copy link
Member Author

eee

@vaxerski
Copy link
Member Author

can you post WAYLAND_DEBUG=1 of kanshi when it fails to re-enable edp1

@leiserfg
Copy link
Contributor

leiserfg commented Aug 29, 2024

I tested with Shikane now (same rules) cause in nixos is easier for me to get the stderror of that one.
shikane.log

@vaxerski
Copy link
Member Author

I don't see anything wrong? What didn't work?

@leiserfg
Copy link
Contributor

The laptop's display stays off.

@vaxerski
Copy link
Member Author

ye from that log I can't see what's wrong? shikane just... doesnt ask us to enable it.

Can you grab a log from something like kde or sway where it works?

@leiserfg
Copy link
Contributor

I will test the PR further tonight.

@leiserfg
Copy link
Contributor

leiserfg commented Aug 29, 2024

I'm testing again. I started hyprland with this as part of my config:

 exec-once = env WAYLAND_DEBUG=1 shikane 2> /tmp/shikane.log

and I'm doing tail -f /tmp/shikane.log, and I don't see logs appearing when I plug and unplug the external monitor. So it is kinda worse than it is in master. Right now my external monitor is showing a fix frame but does not show as enabled in hyprctl monitors.

hypr

shikane logs:
shikane.log

@vaxerski
Copy link
Member Author

hm, thats odd. I'll test on my laptop tomorrow... Does socket2 log anything?

socat -v unix-connect:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock -

@leiserfg
Copy link
Contributor

@vaxerski checking in the git history I found this PR that was what fixed kanshi when a similar problem was happening in the days of wlroots

https://github.com/hyprwm/Hyprland/pull/3718/files#diff-dbcd1ce1e0b916536f17c999473ad9e22c014646ddb2df15c45d726884a3481cR1293-R1300

@vaxerski
Copy link
Member Author

@leiserfg I've rebased this on top of main. I remember some other fixes on main, is this better than the current head?

@leiserfg
Copy link
Contributor

leiserfg commented Sep 25, 2024

I was chatting with the author of shikane and he told me the issue is:

When a display gets unplugged the compositor should send Finished events for the output itself and all its modes to shikane.
In your log shikane only receives events that say that one display is disabled (but not unplugged) and one is enabled.
The Finished events are missing.
And once you plug it back in shikane gets all the initial information again.
For all of its runtime shikane knew that 2 displays existed.
Which should not have been the case because you unplugged your monitor.
There is nothing shikane can do about this.
It sounds interesting as to why the Finished events are not sent to shikane.

@leiserfg
Copy link
Contributor

I think this PR adds more complexity to the whole monitor management and it will be better to keep it closer to what it is in master and try to introduce the proper events, what do you think?

@vaxerski
Copy link
Member Author

No, this system is generally more robust IMO.

Let me try to fix that, thank the shikane dev for me.

@leiserfg
Copy link
Contributor

leiserfg commented Sep 25, 2024

If you wanna try yourself you can use shikane with
env SHIKANE_LOG=trace shikane 2>&1 | grep Event::

.config/shikane/config.toml

[[profile]]
name = "laptop builtin"
   [[profile.output]]
   match = "eDP-1"
   enable = true
   scale = 2.0

[[profile]]
name = "nobuiltin + hp24"
   [[profile.output]]
   match = "eDP-1"
   enable = false

   [[profile.output]]
   search = "/.*"
   enable = true

@vaxerski
Copy link
Member Author

yeah I managed, something is seriously wrong around monitor SPs

@vaxerski
Copy link
Member Author

fixed, try now.

@leiserfg
Copy link
Contributor

Now it works (I even see the Finished events).

@vaxerski
Copy link
Member Author

great, merging then

@vaxerski vaxerski merged commit caaa9b1 into main Sep 26, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants