Add net devices to Conky before starting

This commit is contained in:
2Shirt 2018-09-04 22:22:21 -06:00
parent 0d0defb8de
commit a35be68780
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 17 additions and 10 deletions

View file

@ -3,14 +3,16 @@
IF_LIST=($(ip l | egrep '^[0-9]+:\s+(eth|en|wl)' | sed -r 's/^[0-9]+:\s+(\w+):.*/\1/' | sort))
# Add interfaces to conkyrc
for i in "${IF_LIST[@]}"; do
if [[ "${i:0:1}" == "e" ]]; then
sed -i -r "s/#Network/Wired:\${alignr}\${addr $i}\n#Network/" ~/.conkyrc
else
sed -i -r "s/#Network/Wireless:\${alignr}\${addr $i}\n#Network/" ~/.conkyrc
fi
done
if fgrep '#Network' $HOME/.conkyrc; then
for i in "${IF_LIST[@]}"; do
if [[ "${i:0:1}" == "e" ]]; then
sed -i -r "s/#Network/Wired:\${alignr}\${addr $i}\n#Network/" $HOME/.conkyrc
else
sed -i -r "s/#Network/Wireless:\${alignr}\${addr $i}\n#Network/" $HOME/.conkyrc
fi
done
# Remove '#Network' line to prevent duplicating lines if this script is re-run
sed -i -r "s/#Network//" ~/.conkyrc
# Remove '#Network' line to prevent duplicating lines if this script is re-run
sed -i -r "s/#Network//" $HOME/.conkyrc
fi

View file

@ -16,5 +16,4 @@ connect-to-network &
(sleep 5s && killall dunst) &
$HOME/.urxvt_default_res &
$HOME/.update_wallpaper &
$HOME/.update_conky &
exec openbox-session

View file

@ -1,9 +1,15 @@
setterm -blank 0 -powerdown 0
if [ "$(fgconsole 2>/dev/null)" -eq "1" ]; then
# Update settings if using i3
if fgrep -q "i3" /proc/cmdline; then
sed -i -r 's/#(own_window_type override)/\1/' ~/.conkyrc
sed -i -r 's/openbox-session/i3/' ~/.xinitrc
fi
# Update Conky
$HOME/.update_conky
# Start X or HW-diags
if ! fgrep -q "nox" /proc/cmdline; then
startx >/dev/null
else