Compare commits

..

2 Commits

Author SHA1 Message Date
f13dc7f10e Have a readme again to fix #1 2024-07-06 09:53:37 -04:00
abad26d9d2 No longer use intentention window for status 2024-07-06 09:46:55 -04:00
2 changed files with 43 additions and 11 deletions

13
README.md Normal file
View File

@@ -0,0 +1,13 @@
# AntiDrift
Just my personal productivity tool. It asks me about my intention for the next
work session. Until I have provided an intention, duration, and start a
session, it forcefully minimizes all windows. It then records all active
windows during the session. At the end, it allows me to rate how relevant each
window was and calculates a session score from that.
To use AntiDrift, run `cargo run --release` directly, or `cargo build --release`
and copy the binary into your `PATH`.
Uses `xdotool` to get window titles and minimize windows. Currently Linux with
X11 is the only supported platform.

View File

@@ -94,7 +94,6 @@ impl App {
fn to_end(&mut self) {
self.state = State::End;
self.session_ratings = session_stats_as_vec(&self.session_stats);
self.user_intention = "Press 1, 2, 3 to rate titles".to_string();
}
fn tick_50ms(&mut self) {
@@ -271,7 +270,6 @@ fn handle_events(app: &mut App) -> Result<()> {
if app.session_ratings_index >= app.session_ratings.len() {
app.state = State::InputIntention;
app.user_intention = "Next session!".to_string();
}
}
@@ -300,7 +298,8 @@ fn ui(frame: &mut Frame, app: &App) {
Constraint::Percentage(100),
Constraint::Min(3),
]);
let [layout_intention, layout_duration, layout_titles, layout_status] = layout.areas(frame.size());
let [layout_intention, layout_duration, layout_titles, layout_status] =
layout.areas(frame.size());
let border_type_intention = if app.state == State::InputIntention {
BorderType::Thick
@@ -350,20 +349,40 @@ fn ui(frame: &mut Frame, app: &App) {
}
if app.user_duration == Duration::ZERO {
let span = Span::styled("Provide valid duration in minutes! ", Style::new().fg(Color::LightRed));
let span = Span::styled(
"Provide valid duration in minutes! ",
Style::new().fg(Color::LightRed),
);
spans.push(span);
}
if app.state == State::InProgress {
match app.state {
State::InputIntention | State::InputDuration => {
if spans.len() == 0 {
let span = Span::styled(
"Ready to start next session.",
Style::new().fg(Color::LightGreen),
);
spans.push(span);
}
}
State::InProgress => {
let span = Span::styled("Session In-Progress", Style::new().fg(Color::LightGreen));
spans.push(span);
}
State::ShouldQuit => {}
State::End => {
let span = Span::styled(
"Press 1, 2, 3 to rate titles!",
Style::new().fg(Color::LightBlue),
);
spans.push(span);
}
}
let input_status: Vec<Line> = vec![Line::from(spans)];
frame.render_widget(
Paragraph::new(input_status).block(
Block::bordered().title("Status"),
),
Paragraph::new(input_status).block(Block::bordered().title("Status")),
layout_status,
);
}