Skip to content

Commit e80cb73

Browse files
authored
feat(uptime): replace plugin with sed (#163)
* module(uptime): replace plugin with custom sed * module(uptime): update doc
1 parent 6e40906 commit e80cb73

File tree

2 files changed

+3
-25
lines changed

2 files changed

+3
-25
lines changed

README.md

+1-22
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ Available modules:
300300
- user - display the username
301301
- host - display the hostname
302302
- date_time - display the date and time
303+
- uptime - display the uptime
303304
- [battery](#battery-module) - display the battery
304305

305306
### Customizing modules
@@ -438,28 +439,6 @@ Add the load module to the status modules list.
438439
set -g @catppuccin_status_modules_right "... load ..."
439440
```
440441

441-
### Uptime module
442-
443-
#### Requirements
444-
This module depends on [tmux-uptime](https://github.com/robhurring/tmux-uptime).
445-
446-
#### Install
447-
The preferred way to install tmux-uptime is using [TPM](https://github.com/tmux-plugins/tpm).
448-
449-
#### Configure
450-
Load tmux-uptime after you load catppuccin.
451-
452-
```sh
453-
set -g @plugin 'catppuccin/tmux'
454-
...
455-
set -g @plugin 'robhurring/tmux-uptime'
456-
```
457-
458-
Add the uptime module to the status modules list.
459-
```sh
460-
set -g @catppuccin_status_modules_right "... uptime ..."
461-
```
462-
463442
## Create a custom module
464443

465444
It is possible to add a new custom module or overwrite any of the existing modules.

status/uptime.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# Requires https://github.com/robhurring/tmux-uptime.
21
show_uptime() {
32
local index=$1
43
local icon="$(get_tmux_option "@catppuccin_uptime_icon" "󰔟")"
54
local color="$(get_tmux_option "@catppuccin_uptime_color" "$thm_green")"
6-
local text="$(get_tmux_option "@catppuccin_uptime_text" "#{uptime}")"
5+
local text="$(get_tmux_option "@catppuccin_uptime_text" "#(uptime | sed 's/^[^,]*up *//; s/, *[[:digit:]]* users.*//; s/ day.*, */d /; s/:/h /; s/ min//; s/$/m/')")"
76

8-
local module=$( build_status_module "$index" "$icon" "$color" "$text" )
7+
local module=$(build_status_module "$index" "$icon" "$color" "$text")
98

109
echo "$module"
1110
}

0 commit comments

Comments
 (0)