feat(uptime): replace plugin with sed (#163)
* module(uptime): replace plugin with custom sed * module(uptime): update doc
This commit is contained in:
parent
6e40906b2d
commit
e80cb735bb
2 changed files with 3 additions and 25 deletions
23
README.md
23
README.md
|
@ -300,6 +300,7 @@ Available modules:
|
||||||
- user - display the username
|
- user - display the username
|
||||||
- host - display the hostname
|
- host - display the hostname
|
||||||
- date_time - display the date and time
|
- date_time - display the date and time
|
||||||
|
- uptime - display the uptime
|
||||||
- [battery](#battery-module) - display the battery
|
- [battery](#battery-module) - display the battery
|
||||||
|
|
||||||
### Customizing modules
|
### Customizing modules
|
||||||
|
@ -438,28 +439,6 @@ Add the load module to the status modules list.
|
||||||
set -g @catppuccin_status_modules_right "... load ..."
|
set -g @catppuccin_status_modules_right "... load ..."
|
||||||
```
|
```
|
||||||
|
|
||||||
### Uptime module
|
|
||||||
|
|
||||||
#### Requirements
|
|
||||||
This module depends on [tmux-uptime](https://github.com/robhurring/tmux-uptime).
|
|
||||||
|
|
||||||
#### Install
|
|
||||||
The preferred way to install tmux-uptime is using [TPM](https://github.com/tmux-plugins/tpm).
|
|
||||||
|
|
||||||
#### Configure
|
|
||||||
Load tmux-uptime after you load catppuccin.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
set -g @plugin 'catppuccin/tmux'
|
|
||||||
...
|
|
||||||
set -g @plugin 'robhurring/tmux-uptime'
|
|
||||||
```
|
|
||||||
|
|
||||||
Add the uptime module to the status modules list.
|
|
||||||
```sh
|
|
||||||
set -g @catppuccin_status_modules_right "... uptime ..."
|
|
||||||
```
|
|
||||||
|
|
||||||
## Create a custom module
|
## Create a custom module
|
||||||
|
|
||||||
It is possible to add a new custom module or overwrite any of the existing modules.
|
It is possible to add a new custom module or overwrite any of the existing modules.
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
# Requires https://github.com/robhurring/tmux-uptime.
|
|
||||||
show_uptime() {
|
show_uptime() {
|
||||||
local index=$1
|
local index=$1
|
||||||
local icon="$(get_tmux_option "@catppuccin_uptime_icon" "")"
|
local icon="$(get_tmux_option "@catppuccin_uptime_icon" "")"
|
||||||
local color="$(get_tmux_option "@catppuccin_uptime_color" "$thm_green")"
|
local color="$(get_tmux_option "@catppuccin_uptime_color" "$thm_green")"
|
||||||
local text="$(get_tmux_option "@catppuccin_uptime_text" "#{uptime}")"
|
local text="$(get_tmux_option "@catppuccin_uptime_text" "#(uptime | sed 's/^[^,]*up *//; s/, *[[:digit:]]* users.*//; s/ day.*, */d /; s/:/h /; s/ min//; s/$/m/')")"
|
||||||
|
|
||||||
local module=$(build_status_module "$index" "$icon" "$color" "$text")
|
local module=$(build_status_module "$index" "$icon" "$color" "$text")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue