You are not logged in.
Pages: 1
Hi. I've decided to replace nm-applet with this genmon script to show my ip adrress and connection speed:
#!/bin/bash
# code
d=$(ip addr show enp0s8 | grep -i 'inet' | cut -c10-25
ethtool enp0s8 | grep -i speed | cut -b2-15)
# genmon
#echo "<txt>$d</txt>"
echo "<img>/home/milan/bin/notification-network-ethernet-connected.png</img>"
echo "<click>/home/milan/bin/dhcpcd-renew.sh</click>"
echo "<tool>$d</tool>"
What i want is when the connection is down to show me a different image, let's say to show some 'network-ethernet-disconnected' image when the contents of the tooltip are changed. Is this possible in genmon?
Offline
Try something like this:
#!/bin/bash
# code
if (ip addr | grep enp0s8 | grep "state UP")
then
icon=/home/milan/bin/notification-network-ethernet-connected.png
else
icon=/home/milan/bin/notification-network-ethernet-disconnected.png
fi
d=$(ip addr show enp0s8 | grep -i 'inet' | cut -c10-25
ethtool enp0s8 | grep -i speed | cut -b2-15)
# genmon
#echo "<txt>$d</txt>"
echo "<img>$icon</img>"
echo "<click>/home/milan/bin/dhcpcd-renew.sh</click>"
echo "<tool>$d</tool>"
Change the icon names to suit.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Since 'dhcpcd-renew.sh' only disconnects the dhcp server, not the enp0s8 network interface. i just changed grep 'state UP' to grep 'inet' and it works.
Thank you very much.
Offline
Pages: 1
[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 523.07 KiB (Peak: 528.78 KiB) ]