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

Formattable uptime block? #1247

Closed
origin-master opened this issue May 20, 2021 · 1 comment · Fixed by #2008
Closed

Formattable uptime block? #1247

origin-master opened this issue May 20, 2021 · 1 comment · Fixed by #2008

Comments

@origin-master
Copy link

For my case: I prefer not to show minutes or seconds but I want to see only hours. I usually run my computer more than an hours, and this uptime block shows seconds unit in less than an hour. That was little bothering me.

Since the uptime block is not-too-complicated to implement one (so I think you can feel free to ignore this suggestion), currently I'm using custom block for that with this script:

awk '{printf "⏰ %.1f", ($1 / 3600)}' /proc/uptime

Related code

let text = if hours == 0 && days == 0 && weeks == 0 {
format!("{}m {}s", minutes, seconds)
} else if hours > 0 && days == 0 && weeks == 0 {
format!("{}h {}m", hours, minutes)
} else if days > 0 && weeks == 0 {
format!("{}d {}h", days, hours)
} else if days == 0 && weeks > 0 {
format!("{}w {}h", weeks, hours)
} else if weeks > 0 {
format!("{}w {}d", weeks, days)
} else {
unreachable!()
};

@ammgws
Copy link
Collaborator

ammgws commented May 20, 2021

Sure it seems reasonable to make it formattable.

@bim9262 bim9262 linked a pull request Mar 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants