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(uptime): filter out singular "user" string in sed expression #255

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

bryan-hoang
Copy link
Contributor

@bryan-hoang bryan-hoang commented Jul 19, 2024

Previously, on machines where the logged-in user count is 1, the sed expression to filter out "... X users, ..." doesn't filter out "... X user, ...", leading to something like

1h 05,  1 user,  load average: 0.05, 0.72, 1.62m

being displayed in the module. When the user count is greater than 1 (e.g., after ssh localhost), the uptime module displays

1h 05m

as expected.

With this patch, the module displays correctly when the user count is 1.

The Stack Overflow answer the sed expression is based on 12 doesn't seem to consider the case when the user count is 1.

Footnotes

  1. https://stackoverflow.com/a/28353785

  2. https://github.com/catppuccin/tmux/pull/163

@bryan-hoang bryan-hoang changed the title fix(uptime): filter out singular "user" string in sed fix(uptime): filter out singular "user" string in sed expression Jul 19, 2024
Previously, on machines where the logged-in user count is 1, the `sed`
expression to filter out "... X users, ..." doesn't filter out "... X
user, ...", leading to something like

```
1h 05,  1 user,  load average: 0.05, 0.72, 1.62m
```

being displayed in the module. When the user count is greater than 1
(e.g., after `ssh localhost`), the `uptime` module displays

```
1h 05m
```

as expected.

The Stack Overflow answer the `sed` expression is based on [^1][^2]
doesn't seem to consider the case when the user count is 1.

With this patch, the `uptime` module display correctly when the user
count is 1.

[^1]: https://stackoverflow.com/a/28353785
[^2]: #163
@bryan-hoang bryan-hoang force-pushed the bugfix/uptime-module-single-user branch from 2bc5c58 to 45e74df Compare July 19, 2024 05:40
@vdbe vdbe merged commit 408c02c into catppuccin:main Jul 19, 2024
3 checks passed
@bryan-hoang bryan-hoang deleted the bugfix/uptime-module-single-user branch July 19, 2024 11:48
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.

None yet

2 participants