1
0
mirror of https://github.com/eoli3n/dotfiles synced 2024-11-22 23:12:32 +01:00

change storage to zfs

This commit is contained in:
eoli3n 2020-01-06 22:16:09 +01:00
parent e4cd23e782
commit 16e842be10
3 changed files with 30 additions and 21 deletions

@ -4,7 +4,7 @@
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
"modules-center": [],
"modules-right": ["tray", "custom/spotify", "network#speed", "custom/storageslash", "custom/storagehome", "pulseaudio", "backlight", "network", "custom/vpn", "battery", "clock"],
"modules-right": ["tray", "custom/spotify", "network#speed", "custom/zfs", "pulseaudio", "backlight", "network", "custom/vpn", "battery", "clock"],
"sway/mode": {
"format": " {}"
},
@ -61,17 +61,11 @@
"exec-if": "pgrep spotify",
"escape": true
},
"custom/storageslash": {
"format": "<span foreground='#929292'></span> {}%",
"custom/zfs": {
"format": "<span foreground='#929292'></span> {}%",
"return-type": "json",
"interval": 60,
"exec": "~/.config/waybar/modules/storage.sh /"
},
"custom/storagehome": {
"format": "<span foreground='#929292'></span> {}%",
"return-type": "json",
"interval": 60,
"exec": "~/.config/waybar/modules/storage.sh /home"
"exec": "~/.config/waybar/modules/zfs.sh zroot"
},
"custom/vpn": {
"format": "<span foreground='#929292'></span> vpn",

@ -0,0 +1,23 @@
#!/usr/bin/env bash
warning=85
critical=95
pcent=$(zpool list -o cap -H $1 | tr -d '%')
json_fmt='{"text": "%s" , "class": "%s" }\n'
if [[ -z $pcent ]]
then
echo -e "Usage: ./zfs.sh [zpool_name]\nexemple : ./zfs.sh zroot"
else
if [[ $pcent -lt $warning ]]
then
printf "$json_fmt" "$pcent" "normal"
elif [[ $pcent -ge $warning ]] && [[ $pcent -lt $critical ]]
then
printf "$json_fmt" "$pcent" "warning"
elif [[ $pcent -ge $critical ]]
then
printf "$json_fmt" "$pcent" "critical"
fi
fi

@ -54,7 +54,7 @@ window {
color: @alert;
}
#mode, #battery, #cpu, #memory, #network, #pulseaudio, #backlight, #custom-storageslash, #custom-storagehome, #custom-spotify, #custom-weather, #custom-vpn, #custom-nixos-kernel {
#mode, #battery, #cpu, #memory, #network, #pulseaudio, #backlight, #custom-zfs, #custom-spotify, #custom-weather, #custom-vpn, #custom-nixos-kernel {
margin: 0px 6px 0px 10px;
}
@ -99,18 +99,10 @@ window {
color: rgba(217, 216, 216, 1);
}
#custom-storageslash.warning {
#custom-zfs.warning {
color: @warning;
}
#custom-storageslash.critical {
color: @alert;
}
#custom-storagehome.warning {
color: @warning;
}
#custom-storagehome.critical {
#custom-zfs.critical {
color: @alert;
}