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

fix: improve uptime status sed script to report correct units for a few uptime scenarios #437

Merged
merged 2 commits into from
Dec 8, 2024

Conversation

xafarr
Copy link
Contributor

@xafarr xafarr commented Nov 20, 2024

10:31 up 36 mins, 2 users, load averages: 2.55 4.87 6.81
Screenshot 2024-11-20 at 2 29 15 pm

9:42 up 10 days, 25 mins, 2 users, load averages: 4.71 4.27 4.00
Screenshot 2024-10-21 at 9 55 39 am

18:43 up 21 days, 9 hrs, 2 users, load averages: 3.99 6.48 10.99
Screenshot 2024-10-24 at 9 25 26 AM

The following are examples of current and fixed sed scripts.

Uptime String: 18:43  up 9 hrs, 2 users, load averages: 3.99 6.48 10.99
Current SED: 9 hrsm
Fixed SED: 9h

Uptime String: 18:44  up  9:01, 2 users, load averages: 4.94 6.21 10.55
Current SED: 9h 01m
Fixed SED: 9h 01m

Uptime String: 9:31  up 45 secs, 2 users, load averages: 105.51 24.01 8.61
Current SED: 45 secsm
Fixed SED: 45s

Uptime String: 9:32  up 2 mins, 2 users, load averages: 109.13 55.55 22.93
Current SED: 2sm
Fixed SED: 2m

Uptime String: 22:37:29 up 4 days,  9:44,  1 user,  load average: 0.07, 0.03, 0.01
Current SED: 4d 9h 44m
Fixed SED: 4d 9h 44m

Uptime String: 11:24  up  1:54, 2 users, load averages: 5.25 11.69 13.95
Current SED: 1h 54m
Fixed SED: 1h 54m

Uptime String: 9:30  up 3 days, 0 sec, 2 users, load averages: 3.83 4.47 4.04
Current SED: 3d 0 secm
Fixed SED: 3d 0s

Uptime String: 9:42  up 3 days, 12 mins, 2 users, load averages: 4.71 4.27 4.00
Current SED: 3d 12sm
Fixed SED: 3d 12m

Uptime String: 9:56  up 10 days, 26 mins, 2 users, load averages: 2.26 2.28 2.49
Current SED: 10d 26sm
Fixed SED: 10d 26m

@xafarr
Copy link
Contributor Author

xafarr commented Dec 7, 2024

@kjnsn Can you please have a look at this PR?

@kjnsn
Copy link
Collaborator

kjnsn commented Dec 7, 2024

Ideally I'd like to use the inbuilt strftime format string capabilities in order to provide something sensible. Which would also be locale-specific

@xafarr
Copy link
Contributor Author

xafarr commented Dec 7, 2024

I understand. But this PR is for fix/improvement of the current sed processing.

As far as I know, uptime is currently only in English. I may be completely wrong. So for uptime to have strftime type format, it's going to be a bit of work. Also, uptime suppose to be just duration from system start, strftime would be overkill/confusing in my opinion.

Let me know if I have misunderstood your suggestion. Thanks.

@kjnsn
Copy link
Collaborator

kjnsn commented Dec 8, 2024

Got it. To be clear I'm not against this change, and at the same time I generally keep myself curious to "better" solutions at the same time.

This is definitely an improvement, LGTM

@kjnsn kjnsn merged commit 31fc2bf into catppuccin:main Dec 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants