This is an example that opens a text-info dialog when you click the item in the notification dialog's popup menu.stemsee wrote:Here is an idea I would like to get working.This uses yad --notification --listen to change menu items. In this usage the menu items are the APs found from iwlist scan. The APs are one per line, "AP1"|"AP2"|"AP3" how to interpolateCode: Select all
mkfifo -m 755 /tmp/PIPE9 2>/dev/null exec 9<> /tmp/PIPE9 function scan (){ PATTERN=' s/^.*ESSID://p' MENU=`iwlist wlan2 scan | sed -rn "$PATTERN" | tac | tr '\n' '|'` list=`echo $MENU >/tmp/scan` echo "menu:$MENU" >&9 & } export -f scan yad --notification --icon=/usr/share/pixmaps/wireless.png --listen --text="Scanner" --command="geany /tmp/scan" <&9 & while true do bash -c scan sleep 4 done
The problems I need to help to solve are 1) only scan on click.Code: Select all
!bash -c connect1!/usr/share/pixmaps/wireless.png| "AP1"|bash -c connect1|/usr/share/pixmaps/wireless.png|"AP2"!bash -c connect2!/usr/share/pixmaps/wireless.png|
2) click on menu item to select AP to connect with
3) show an icon next to each AP entry
Code: Select all
#!/bin/bash
mkfifo -m 755 /tmp/PIPE9 2>/dev/null
trap "rm -f /tmp/PIPE9" EXIT
exec 9<> /tmp/PIPE9
function scan (){
PATTERN='
s/^.*ESSID://p'
iwlist wlan2 scan | sed -rn "$PATTERN" | tac >/tmp/scan
MENU="$(while read -r line ;do
printf "%s" "Connect $line!bash -c "yad --text-info --width=400 --height=300 <<<$(echo $line)"!/usr/share/pixmaps/wireless.png|"
done < /tmp/scan)"
echo "icon:/usr/share/pixmaps/wireless.png" >/tmp/PIPE9
echo "tooltip:Tooltip" >/tmp/PIPE9
echo "menu:Refresh!bash -c scan!gtk-refresh|About!bash -c 'yad --about'!gtk-about||$MENU|Quit!quit!gtk-quit" >/tmp/PIPE9
}
export -f scan
yad --notification --listen --text="Scanner" --command="geany /tmp/scan" <&9 & NOTIF_ICON=$!
sleep 1
bash -c scan
wait $NOTIF_ICON