Giter VIP home page Giter VIP logo

Comments (6)

Hummer12007 avatar Hummer12007 commented on May 23, 2024 1

There's some work-in-progress code in the anim branch, I think there are a few concurrency left to be resolved.

from brightnessctl.

Hummer12007 avatar Hummer12007 commented on May 23, 2024

Sure! It's an awesome idea. I'll definitely merge a PR.

If you're up to it, I'd be glad to discuss the implementation with you.

from brightnessctl.

akiva avatar akiva commented on May 23, 2024

I would be happy to try and help with this—it would be my first c-based PR. Would you care to provide any implementation tips here or in e-mail? Cheers!

from brightnessctl.

Hummer12007 avatar Hummer12007 commented on May 23, 2024

Great!
You will roughly need to do the following:

  • Add an option for transition duration (0 by default)
  • An example of a way to implement smooth transition would be: when the transition duration is non-zero, you can split the duration into equal chunks (|d->curr_brightness - new| chunks to be precise, https://github.com/Hummer12007/brightnessctl/blob/master/brightnessctl.c#L325) , and increment/decrement the brightness, writing the new value on each chunk.

I'd also like you to consider what would happen if a user executes multiple instances of smooth transition concurrently, and how/whether we'd need to handle that.

from brightnessctl.

CameronNemo avatar CameronNemo commented on May 23, 2024

FWIW my project brillo implements this feature. Most of the functionality to enable it is concentrated in this file (note: this is 0BSD now).

Some tips from my experience:

  • You need to decide on a sleep interval at which to write to the brightness file, and if it is too rapid udevd will eat up a lot of resources. I used 100 writes per second; you may not need this many.
  • You will need to write at each interval, then flush the write data (if applicable), then sleep the remaining time in the interval.
  • You will need to check the clock before and after each write. The write may take some time, so you will need to subtract the difference from the sleep interval duration.

Best of luck!

from brightnessctl.

dirdi avatar dirdi commented on May 23, 2024

This would be a really nice feature. Unfortunately my C skills are very limited, so I can not provide a PR. However, I wrote this short BASH script that does the job:

I=0
while [ $I -lt 10 ]; do
    brightnessctl -c backlight -q s 2%-
    sleep 0.05
    ((I = I + 1));
done

Adjust the values to fit your needs.

from brightnessctl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.