-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaily_task_manager.sh
More file actions
executable file
·131 lines (114 loc) · 5.07 KB
/
Copy pathdaily_task_manager.sh
File metadata and controls
executable file
·131 lines (114 loc) · 5.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
# Daily Task Manager - Enhanced startup with system integration
# This script provides a complete daily task management experience
clear
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ 🎯 DAILY TASK MANAGER ║"
echo "║ Self-Balancing Productivity System ║"
echo "╚══════════════════════════════════════════════════════════════╝"
echo ""
# Check if it's a new day and apply daily increments
check_daily_increment() {
local last_run_file="$HOME/.taskflow_last_run"
local today=$(date +%Y-%m-%d)
if [ -f "$last_run_file" ]; then
local last_run=$(cat "$last_run_file")
if [ "$last_run" != "$today" ]; then
echo "📅 New day detected! Applying daily increments..."
# Start the app briefly to apply increments
cd ~/my_task_managing
./start_app.sh > /dev/null 2>&1 &
sleep 5
curl -s -X POST http://127.0.0.1:5000/api/daily-increment
./stop_app.sh > /dev/null 2>&1
sleep 2
echo "✅ Daily increments applied!"
fi
fi
# Update last run date
echo "$today" > "$last_run_file"
}
# Show motivational message based on time
show_time_greeting() {
local hour=$(date +%H)
local greeting=""
local emoji=""
if [ $hour -lt 6 ]; then
greeting="Early bird"
emoji="🌅"
elif [ $hour -lt 12 ]; then
greeting="Good morning"
emoji="☀️"
elif [ $hour -lt 17 ]; then
greeting="Good afternoon"
emoji="🌤️"
elif [ $hour -lt 21 ]; then
greeting="Good evening"
emoji="🌆"
else
greeting="Night owl"
emoji="🌙"
fi
echo "$emoji $greeting! Ready to balance your tasks?"
echo ""
}
# Show current task summary
show_task_summary() {
if [ -f ~/taskflow_backup/tasks_original.db ]; then
echo "📊 Your Task Summary:"
echo "────────────────────────────────────────"
echo "💾 Personal data: ✅ Available"
echo "🎯 Goal: Keep total score ≤ 0"
echo "🔄 System: Auto-increments daily"
echo ""
else
echo "🆕 Welcome to TaskFlow!"
echo "────────────────────────────────────"
echo "📝 This is your first time running TaskFlow"
echo "🎯 Goal: Balance your tasks using numerical scoring"
echo "📊 Demo data will be loaded for you to explore"
echo ""
fi
}
# Main execution
main() {
show_time_greeting
show_task_summary
check_daily_increment
echo "🚀 Starting TaskFlow..."
echo "════════════════════════════════════════"
# Use the fish function if available, otherwise use direct script
if command -v fish > /dev/null && fish -c "functions -q todaytask" 2>/dev/null; then
fish -c "todaytask"
else
# Fallback to direct execution
cd ~/my_task_managing
# Restore data
if [ -f ~/taskflow_backup/tasks_original.db ]; then
cp ~/taskflow_backup/tasks_original.db backend/tasks.db
fi
./start_app.sh
# Try to open browser
sleep 3
if command -v xdg-open > /dev/null; then
xdg-open "http://127.0.0.1:8080" 2>/dev/null
elif command -v open > /dev/null; then
open "http://127.0.0.1:8080" 2>/dev/null
else
echo "🌐 Please open http://127.0.0.1:8080 in your browser"
fi
fi
echo ""
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ TaskFlow is now running! Focus on achieving balance! 🎯 ║"
echo "║ ║"
echo "║ 💡 Tips: ║"
echo "║ • Red scores need attention ║"
echo "║ • Green scores mean you're ahead ║"
echo "║ • Aim for zero total score ║"
echo "║ ║"
echo "║ Type 'stoptask' when done ║"
echo "╚══════════════════════════════════════════════════════════════╝"
}
# Run the main function
main