mirror of
https://github.com/avinal/dotfiles.git
synced 2026-07-04 07:20:09 +05:30
feat: major update to all configs
- move older config to archive Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
output=$(wakatime --today)
|
||||
|
||||
# Extract hours and minutes using awk and sum the total
|
||||
total_minutes=$(echo "$output" | awk -F' ' '
|
||||
{
|
||||
for (i=1; i<=NF; i++) {
|
||||
if ($i == "hrs" || $i == "hr") total += $(i-1) * 60;
|
||||
if ($i == "mins" || $i == "min") total += $(i-1);
|
||||
}
|
||||
} END {print total}')
|
||||
|
||||
# Calculate total hours and remaining minutes
|
||||
total_hours=$((total_minutes / 60))
|
||||
remaining_minutes=$((total_minutes % 60))
|
||||
|
||||
# Print the results
|
||||
printf '{"text":"%02dh %02dm","tooltip":"%s","class":"wakatime"}' $total_hours $remaining_minutes "$output" | jq --unbuffered --compact-output
|
||||
Reference in New Issue
Block a user