add swap support

This commit is contained in:
koksnuss 2018-05-14 00:53:21 +02:00
parent c7d9be3434
commit d719a45bf7
3 changed files with 11 additions and 5 deletions

View File

@ -11,13 +11,14 @@ Adjust `~/.config/i3blocks/config` to control i3 status bar output. Finally relo
# Requirements
The following shows the requirements for each script:
```bash
audio amixer
audio,mic amixer
battery none, searches in /sys/class/power_supply/BAT...
cpu top
datetime date
ip curl
ram none, searches in /proc/meminfo
ram,swap none, searches in /proc/meminfo
storage df
backlight none, searches in /sys/class/backlight, intel and ati/amd supported
```
# Roadmap
@ -33,7 +34,7 @@ storage df
- [x] cpu
- [x] backlight
- [x] microphone
- [ ] swap
- [x] swap
- [ ] wifi/ethernet/bluetooth
- [ ] external storage with mount
- [ ] ethernet bandwith

4
config
View File

@ -14,6 +14,10 @@ label=storage
[ram]
label=ram
[ram]
label=swap
instance=swap
[cpu]
label=cpu

5
ram
View File

@ -1,6 +1,7 @@
#!/bin/bash
gawk '
/^MemAvailable:/ {
[[ ${BLOCK_INSTANCE} == 'swap' ]] && TYPE="SwapFree" || TYPE="MemAvailable"
gawk -v type="$TYPE" '
$0 ~ type {
mfg=$2/1024^2
mfm=$2/1024
}