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

[Suggestion] Improvements to the display/screen sync #75

Open
DatCaptainHorse opened this issue Oct 5, 2023 · 2 comments
Open

[Suggestion] Improvements to the display/screen sync #75

DatCaptainHorse opened this issue Oct 5, 2023 · 2 comments

Comments

@DatCaptainHorse
Copy link

Looking at the code of screen sync, it feels almost criminal how it's been kept so simple for so long!

Relying on single pixel per-side, without any sort of smoothing from previous color or averaging of color causes syncing to be very rough with big screen changes. Especially for games.

Here's some improvements that can be done, like I mentioned above:

  1. Use region average or another way of getting common color, rather than from single pixel per-side.
  2. Store previous color to further smoothen out big changes on screen, speed of smoothing would depend on existing intensity value ideally.

Decent Javascript knowledge should be enough for someone to PR these changes 🙂
(I would do this myself, but my meds have supply issues and I've ran out, so my brain has turned to slime)

@vchlum
Copy link
Owner

vchlum commented Oct 5, 2023

Hi @DatCaptainHorse ! Thank you for your suggestion. I wanted to improve it, but I wasn't able to find a better and working solution so far. The problem is to get the region's average color in GJS in time. The only way I found was to use the gnome-shell function getColorPixel(), which is at least... fast enough if only a few pixels are used.

I tried several approaches like gstreamer or taking screenshots of the whole desktop and analyzing. Taking screenshots is too slow. Much slower than calling getColorPixel() a few times. I hope someday I will change this feature to use the gstreamer but currently it is not possible. Long story short: this issue: https://gitlab.gnome.org/GNOME/gjs/-/issues/557 is stopping me. I can not connect to the signal from gstreamer successfully.

Do have an idea of how to get the screen color fast enough in gjs? Please share the technical knowledge:-) ...or at least which component would you use? I will happily improve the sync feature with such a hint.

@hobbesjaap
Copy link

Hi @vchlum , if I could add my thoughts to this and start with a big thank you for this software - I love it. I just bought a Hue Gradient Light Strip for my PC and it's working in Linux, using your software, in Wayland. Huestacean and Huenicorn don't work, so thank you!!

I think the screen colour picker is not the main issue (for me, at least). It seems that when I'm playing a game, or am on my desktop, the colours get sampled OK.

The main issue is that there is no blending of colours as they transition from one to the next. What I mean by this is:

ColourGetsSampled -> NewColourGetsSampled -> InstantChange (it's an instant transition and is quite jarring)

I would suggest a transition.

ColourGetsSampled -> NewColourGetsSampled -> GradualChange

Now I don't know how to code, but this YouTube video for a complete different app probably shows it best:

https://www.youtube.com/watch?v=HwB3eh-D870

As mentioned earlier, if this colour-blending could happen faster-slower depending on "Intensity" setting, that would be helpful.

Does this make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants