Skip to content

Commit 00c7479

Browse files
Merge pull request #337 from luftaquila/feature/arch-and-uptime
Add new plugin cpu-arch and uptime
2 parents f5bd9ba + 56b0854 commit 00c7479

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ In depth configuration of Colors and alternative themes can be found [in the doc
2929
- Battery percentage and AC power connection status with icons
3030
- Refresh rate control
3131
- CPU usage (percentage or load average)
32+
- CPU architecture
3233
- RAM usage (system and/or tmux server)
3334
- Custom status texts from external scripts
3435
- GPU stats
@@ -39,6 +40,7 @@ In depth configuration of Colors and alternative themes can be found [in the doc
3940
- When prefix is enabled, the left status bar widget turns from green to yellow
4041
- If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature
4142
- Read system temperature
43+
- Read system uptime
4244
- Info if the Panes are synchronized
4345
- Spotify playback (needs the tool spotify-tui installed). max-len can be configured.
4446
- Music Player Daemon status (needs the tool mpc installed)

docs/CONFIG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [attached-clients](#attached-clients---up)
1111
- [battery](#battery---up)
1212
- [continuum](#continuum---up)
13+
- [cpu-arch](#cpu-arch---up)
1314
- [cpu-usage](#cpu-usage---up)
1415
- [cwd](#cwd---up)
1516
- [fossil](#fossil---up)
@@ -33,6 +34,7 @@
3334
- [terraform](#terraform---up)
3435
- [time](#time---up)
3536
- [tmux-ram-usage](#tmux-ram-usage---up)
37+
- [uptime](#uptime---up)
3638
- [weather](#weather---up)
3739
- [custom:script-name](#customscript-name---up)
3840

@@ -224,6 +226,14 @@ Other options.
224226
@continuum-save-interval
225227
```
226228

229+
### cpu-arch - [up](#table-of-contents)
230+
This widget displays the cpu architecture.
231+
232+
possible nerdfont settings for cpu arch label:
233+
```bash
234+
set -g @dracula-cpu-arch-label "󰍛 "
235+
```
236+
227237
### cpu-usage - [up](#table-of-contents)
228238
This widget displays the cpu usage in percent by default, but can display cpu load on linux.
229239
Load average – is the average system load calculated over a given period of time of 1, 5 and 15 minutes (output: x.x x.x x.x)
@@ -583,6 +593,15 @@ Nerdfont icons to consider:
583593
```
584594
   󰍛 󰘚
585595
```
596+
597+
### uptime - [up](#table-of-contents)
598+
Shows how long the system has been running.
599+
600+
Possible nerdfont settings for uptime:
601+
```
602+
@dracula-uptime-label "󱎫 "
603+
```
604+
586605
### weather - [up](#table-of-contents)
587606
Show weather information for given location.
588607

scripts/cpu_arch.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# setting the locale, some users have issues with different locales, this forces the correct one
3+
export LC_ALL=en_US.UTF-8
4+
5+
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
source $current_dir/utils.sh
7+
8+
main()
9+
{
10+
cpu_label=$(get_tmux_option "@dracula-cpu-arch-label" "ARCH")
11+
echo "$cpu_label `uname -m`"
12+
}
13+
14+
main

scripts/dracula.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,15 @@ main() {
323323
elif [ $plugin = "sys-temp" ]; then
324324
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-sys-temp-colors" "green dark_gray")
325325
script="#($current_dir/sys_temp.sh)"
326+
327+
elif [ $plugin = "cpu-arch" ]; then
328+
IFS=$' ' read -r -a colors <<< $(get_tmux_option "@dracula-cpu-arch-colors" "default default")
329+
script="#($current_dir/cpu_arch.sh)"
330+
331+
elif [ $plugin = "uptime" ]; then
332+
IFS=$' ' read -r -a colors <<< $(get_tmux_option "@dracula-uptime-colors" "default default")
333+
script="#($current_dir/uptime.sh)"
334+
326335
else
327336
continue
328337
fi

scripts/uptime.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# setting the locale, some users have issues with different locales, this forces the correct one
3+
export LC_ALL=en_US.UTF-8
4+
5+
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
source $current_dir/utils.sh
7+
8+
main()
9+
{
10+
uptime_label=$(get_tmux_option "@dracula-uptime-label" "UP")
11+
uptime=$(uptime | awk -F' up ' '{ split($2,a,","); printf "%s", a[1] }')
12+
echo "$uptime_label $uptime"
13+
}
14+
15+
main

0 commit comments

Comments
 (0)