-
Notifications
You must be signed in to change notification settings - Fork 29
Conversation
I think you should be able to disconnect and leave gamma as it was, no reason to leave a process hanging around. Consider that gamma ramps might be used for color tuning as well. |
I really don't think it's a good idea. Setting an invalid gamma table can make your output unusable. In general Wayland clients cannot set permanent state and I think this is a good thing. Color management will be more involved, so it'll most likely require a separate protocol (see https://lists.freedesktop.org/archives/wayland-devel/2016-November/031729.html). |
fwiw I run redshift in one-shot mode from key bindings, having it carrying on running from there is definitely not impossible but smooth transition from one step to the next might suck a bit... (would need to start the next redshift, wait until it applied its ramp, then kill the previous one; otherwise killing the previous one would reset the gamma ramp once and flicker the screen) However I do agree that in general not being able to leave a broken state behind is a good thing, so I guess it's just a matter of fixing the usage pattern e.g. giving redshift a proper remote-control protocol instead. |
Can't they just leave it broken by fucking up the gamma and then not disconnecting? |
Yeah this is the intended behaviour.
Except it's way easier to debug and to fix. You know exactly who's responsible for this mess, and you can kill it to get a sane state back. |
How are you going to debug it, kill it, etc if your screens are hosed? |
I meant a remote-control protocol to control redshift, not to adjust the gamma ramp. There's currently no way to manually adjust the screen temperature other than one-shot mode, which exits immediately after changing the temperature. I wonder why people figure time and location are any good to decide how red the screen should be in the days of artificial light -_- |
LGTM. I'd also go for not resetting the gamma ramp when he client disconnects, since (as you wrote) it's for privileged clients. |
ssh in? At least you got an offender, and can fix it without digging out a potentially new client that then just needs to do some repairs |
This mechanism also ensures that there aren't two clients setting gamma ramps at the same time.
Yeah, that's what I understood. I think redshift should allow this (doesn't it already allow this via its traybar icon menu?).
If you know the offender, you can blindly open a terminal and
Privileged isn't an excuse to allow anything. For instance layer-shell is privileged but constrains a lot what the client is able to do. When I discussed this protocol on #wayland a while ago ensuring there's no dirty state after a client exits was a concern. And I think it's a valid one. |
Yeah that actually makes it so I won't be able to hack in two "set-and-daemonize" one-shot instance of redshifts to set next gradiant of gamma before killing the previous one, I almost complained when I realized that I would actually have to give this a proper control implementation instead :P tbh I think this would be fine with a "latest who gives an order wins" design like it does on X11, would just need to be careful on reset to reset the previous last state on exit (and not reset anything if exiting client wasn't the last one), but both are valid designs so I don't really care either way.
My bad, I had read your answer with "this" being "this new protocol". You just made me install redshift-gtk to try the tray icon, it doesn't seem to have any gimmick other than disabling redshift altogether temporarily, but I might be missing out. It does this with SIGUSR1 == toggle, so that's not really exactly extensible; the report info given in the widget come from stdout of the redshift daemon. FWIW though, Quartz (OSX) has the same behaviour of resetting the gamma ramp when redshift exits, so you can pretend we're being cool by doing like Apple (sorry, couldn't resist) |
tables. At any time the compositor can send a failed event indicating that | ||
this object is no longer valid. | ||
|
||
There must always be at most one gamma control object per output, which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe define it here in the protocol that it's not possible to obtains a second object for the same output (so it's not implementation-defined whether the second one will invalidate the first one or not). Or the other way around if that makes more sense (I think it doesn't)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, the decision what to do should lie with the compositor. Maybe change the wording to "There can only be.." so it's clear that it's not the user's duty to check if they're the only one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
output. | ||
|
||
The client will receive the gamma size, and will then be able to set gamma | ||
tables. At any time the compositor can send a failed event indicating that |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, it's the failed
event, but what about the error enum? That doesn't seem to be used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Protocol errors are reserved for situations in which the client does something wrong. Protocol errors are suitable for a client passing a gamma with an invalid size, but are unsuitable for signaling that an output doesn't support gamma control.
There can only be at most one gamma control object per output, which | ||
has exclusive access to this particular output. When the gamma control | ||
object is destroyed, the gamma table is restored to its original value. | ||
</description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be good to reset the gamma table not when gamma_control is destroyed but when the gamma_control_manager is destroyed? This would
- avoid having the app to hold the gamma_control all the time (can release it when after updating the table)
- would still give a sane output when the client disconnects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'm not sure what the upside is, since you'll need to hold the gamma_control_manager instead of the gamma_control?
- Clients are supposed to keep the gamma_control around to keep a "lock" on the output and prevent other clients from controlling the same output. How would this mechanism work with your proposal?
- A common Wayland idiom is to create the manager, create the control, and immediately destroy the manager. This is done with
wl_region
for instance (clients create a region, assign it to a surface, and then immediately destroy it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The upside is since the manager is the singleton global the client is unlikely to dismiss it since it will need it anyway to handle monitor hotplug. (in your region example the wl_compositor is the singleton global not the region). I also wonder how much sense it makes to have different clients to be able to keep a lock for different outputs.
output. | ||
|
||
The client will receive the gamma size, and will then be able to set gamma | ||
tables. At any time the compositor can send a failed event indicating that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, it's the failed
event, but what about the error enum? That doesn't seem to be used anywhere
It's used by |
This uses file descriptors instead of arrays to fix swaywm/wlroots#1135.
It also adds descriptions and clearer semantics.
reset_gamma
is removed in favour of using thedestroy
request, and afailed
event is added.As always, comments are welcome. Do we want anything else in this protocol?