Skip to content

Commit

Permalink
Release v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadoySV committed Oct 29, 2023
1 parent a40630f commit 91987cf
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 33 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ jobs:
- name: Test
run: cargo test --release
- name: Build
run: cargo build --release
run: |
cargo build --release
cp ./target/release/work-break.exe ./Work-break.exe
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: ./target/release/work-break.exe
files: ./Work-break.exe

linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -83,7 +85,7 @@ jobs:
maintainer: Sergei Shadoy <shadoysv@gmail.com>
version: ${{ github.ref }}
arch: "amd64"
desc: "Work-break balancer for Windows / MacOS / Linux desktops"
desc: "Work and rest time balancer taking into account your current and today strain"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0] - 2023-10-30

### Changed

- Low urgency notifications are not used anymore

## [0.3.1] - 2023-10-18

### Changed
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "work-break"
version = "0.3.1"
version = "0.4.0"
edition = "2021"
description = "Work-break balancer for Windows / MacOS / Linux desktops"
license = "MIT"
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The notification contains the current phase, strain and today work time, needed

## How to install

<a href="https://www.softpedia.com/get/Others/Home-Education/work-break.shtml"><img style="float: right;" src="https://www.softpedia.com/_img/softpedia_100_free.png?2023_1" alt="" /></a>

### Compatibility

Windows 8+ (requires [MS Visual C++ 2015](https://www.microsoft.com/en-us/download/details.aspx?id=52685), tested on Windows 10)
Expand Down Expand Up @@ -99,6 +101,7 @@ phase3_name = "Injury"
The **coefficients** are used for the formula: **break = a * (work ^ (b + d * today_work)) + c**. Variables **work**, **today_work** and **break** represent in seconds. Consider setting **coefficient_d** to `0.00001528` to see how today work time can increase resting time.

**daily_work_time_limit** represents in minutes, sends you notification when today work time reaches the limit, zero turns the notification off.

**work_days_start_at** defines an hour when work days start at and count resets (from 0 to 23).

**phase1_ends_at** and **phase2_ends_at** define current strain's thresholds to send you notifications.
Expand Down
2 changes: 1 addition & 1 deletion extra/linux/etc/xdg/autostart/Work-break.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Categories=Utility;

Name=Work-break
GenericName=Time tracker
Comment=This balancer can track your work time and suggest resting time. It passes through the Pomodoro Technique (25/5) and the 52/17 rule.
Comment=Work and rest time balancer taking into account your current and today strain
StartupNotify=false
StartupWMClass=Work-break
2 changes: 1 addition & 1 deletion extra/linux/usr/share/applications/Work-break.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Categories=Utility;

Name=Work-break
GenericName=Time tracker
Comment=This balancer can track your work time and suggest resting time. It passes through the Pomodoro Technique (25/5) and the 52/17 rule.
Comment=Work and rest time balancer taking into account your current and today strain
StartupNotify=false
StartupWMClass=Work-break
2 changes: 1 addition & 1 deletion extra/osx/Work-break.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.3.1</string>
<string>0.4.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
15 changes: 0 additions & 15 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use chrono::{DateTime, Local};
use interprocess::local_socket::LocalSocketListener;

use notify_rust::Notification;
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
use notify_rust::Urgency;
use serde::{Deserialize, Serialize};

use crate::{
Expand Down Expand Up @@ -205,25 +203,12 @@ impl App {
&& work >= daily_work_time_limit;

if notify_anyway || notify_on_threshold {
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
let mut urgency = Urgency::Low;

#[cfg(not(any(target_os = "windows", target_os = "macos")))]
if strain >= phase2_ends_at
|| !daily_work_time_limit.is_zero() && work >= daily_work_time_limit
{
urgency = Urgency::Normal;
}

let mut notification = Notification::new();
notification
.summary("Work-break balancer")
.auto_icon()
.body(&status);

#[cfg(not(any(target_os = "windows", target_os = "macos")))]
notification.urgency(urgency);

notification.show()?;
}

Expand Down
16 changes: 8 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod math;

use app::{socket_name, App, Ipc};

/// Work-break balancer can track your work time and suggest resting time
/// Work and rest time balancer taking into account your current and today strain
#[derive(Parser)]
pub struct Cli {
#[command(subcommand)]
Expand All @@ -36,6 +36,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let socket = socket_name();

match &cli.command {
None => {
if let Ok(stream) = LocalSocketStream::connect(&*socket) {
ron::ser::to_writer(stream, &Ipc::Switch)?;
} else {
App::new()?.start(true)?;
}
}
Some(Commands::Autorun) => {
App::new()?.start(false)?;
}
Expand All @@ -55,13 +62,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let stream = LocalSocketStream::connect(&*socket).map_err(|_| "App is not running")?;
ron::ser::to_writer(stream, &Ipc::Terminate)?;
}
None => {
if let Ok(stream) = LocalSocketStream::connect(&*socket) {
ron::ser::to_writer(stream, &Ipc::Switch)?;
} else {
App::new()?.start(true)?;
}
}
};

Ok(())
Expand Down

0 comments on commit 91987cf

Please sign in to comment.