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

Add a graph that shows the brightness over the day #29

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 94 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solar-screen-brightness"
version = "2.1.0"
version = "2.2.0"
authors = ["Jacob Halsey <[email protected]>"]
edition = "2021"
build = "build.rs"
Expand Down Expand Up @@ -32,6 +32,7 @@ human-repr = "1.1.0"
image = "0.24.7"
itertools = "0.11.0"
log = "0.4.14"
num = "0.4.1"
png = "0.17.10"
pollster = "0.3.0"
serde = { version = "1.0.110", features = ["derive"] }
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build status](https://github.com/jacob-pro/solar-screen-brightness/actions/workflows/rust.yml/badge.svg)](https://github.com/jacob-pro/solar-screen-brightness/actions)

Varies screen brightness according to sunrise/sunset times.
Automatically and smoothly adjusts monitor brightness based on the sunrise/sunset times at your location.

> #### New 2.0 Release!
>
Expand All @@ -19,26 +19,26 @@ automatically adjust screen brightness.

This changes the screen brightness via monitor control APIs, whereas those utilities vary the colour temperature.

### How to Install

For Windows, you can download pre-compiled binaries from
[Releases](https://github.com/jacob-pro/solar-screen-brightness/releases).

If you are using Linux, please read the [Linux Guide](linux/README.md)

There is also a CLI only version of the application available.

### How to Use

1. An icon will appear in your tray when it is running.
2. Click on the icon to launch the console window.
2. Click on the icon to open the settings menu.
3. Use the menus to set:
- Daytime and Nighttime brightness percentages.
- Transition time (the time it takes to switch between the two brightness values at either sunset or sunrise).
- Your location (either manually enter coordinates, or using the search tool).
4. Click save and this configuration will be applied and persisted to disk.
5. You can close the window, and it will continue to update your brightness in the background.

### How to Install

For Windows, you can download pre-compiled binaries from
[Releases](https://github.com/jacob-pro/solar-screen-brightness/releases).

If you are using Linux, please read the [Linux Guide](linux/README.md)

There is also a CLI only version of the application available.

## Screenshots

![](./screenshots/status.png)
Expand Down
Binary file removed brightness.png
Binary file not shown.
Binary file modified screenshots/brightness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/status.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ pub fn apply_brightness(
.iter()
.map(MonitorOverrideCompiled::from)
.collect::<Vec<_>>();
let now = SystemTime::now();
let epoch_time_now = now.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64;
let epoch_time_now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs() as i64;
let sun = SunriseSunsetParameters::new(epoch_time_now, location.latitude, location.longitude)
.calculate()
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use validator::Validate;

const CONFIG_FILE_NAME: &str = "config.json";

#[derive(Debug, Deserialize, Serialize, Validate, Clone)]
#[derive(Debug, Deserialize, Serialize, Validate, Clone, Copy, PartialEq)]
pub struct Location {
#[validate(range(min = -90, max = 90))]
pub latitude: f64,
Expand Down
Loading
Loading