Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-10-11 13:01:20

oldrust
Member
Registered: 2021-01-05
Posts: 16

genmon icon change

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

#2 2022-10-11 16:21:45

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: genmon icon change

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

#3 2022-10-11 20:09:53

oldrust
Member
Registered: 2021-01-05
Posts: 16

Re: genmon icon change

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. smile

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 523.07 KiB (Peak: 528.78 KiB) ]