# HG changeset patch # User Aleksej Bobylev # Date 1448247178 -7200 # Node ID 688494ca8f5f75485fc4e79ad80d45c49f7d2401 # Parent be92096053b2d12daa67174c150beeae170a93a1 tazpkg-notify: also use notify-send for desktop notifications diff -r be92096053b2 -r 688494ca8f5f tazpkg-box --- a/tazpkg-box Sun Nov 22 19:11:25 2015 +0100 +++ b/tazpkg-box Mon Nov 23 04:52:58 2015 +0200 @@ -15,7 +15,7 @@ text="$(_ 'SliTaz Package Action')" icon="system-software-install" opts="--window-icon=$icon --image=$icon --image-on-top --center --on-top \ ---height=350 --width=520 --title=TazPkg" +--height=350 --width=570 --title=TazPkg" usage() { @@ -36,7 +36,7 @@ # Nice GTK output for install and extract. output() { - yad --text-info $opts --tail --margins='4' --text="$text" \ + yad --text-info $opts --tail --margins='4' --text="$text" --fontname='monospace,8' \ --button='gtk-close:0' } diff -r be92096053b2 -r 688494ca8f5f tazpkg-notify --- a/tazpkg-notify Sun Nov 22 19:11:25 2015 +0100 +++ b/tazpkg-notify Mon Nov 23 04:52:58 2015 +0200 @@ -21,6 +21,7 @@ fifo=/tmp/$(basename $0).fifo doc="file:///usr/share/doc/tazpkg/tazpkg.html" +tp='http://127.0.0.1:82/user/pkgs.cgi' installed=$(wc -l < "$PKGS_DB/installed.info") text="$(_p \ @@ -32,6 +33,19 @@ up=0; [ -f "$PKGS_DB/packages.up" ] && up=$(wc -l < "$PKGS_DB/packages.up") +# Standard notification, if available + +notify() { + if [ -n "$(which notify-send)" ]; then + case $2 in + info) icon='dialog-information'; urgency='normal';; + *) icon='dialog-warning'; urgency='critical';; + esac + notify-send -i $icon -u $urgency 'TazPkg' "$1" & + fi +} + + # Notification icon listen() { @@ -42,8 +56,9 @@ exec 3<> $fifo # Notification icon - yad --notification --listen --image='software-update-available' \ - --text="$(_ 'Checking packages lists - %s' "$text")" <&3 + tooltip="$(_ 'Checking packages lists - %s' "$text")" + notify "$tooltip" 'info' & + yad --notification --listen --image='software-update-available' --text="$tooltip" <&3 # Clean-up rm -f $fifo @@ -81,6 +96,7 @@ # Missing packages list if [ ! -f "$PKGS_DB/packages.info" ]; then tooltip="$(_ 'No packages list found - %s' "$text")" + notify "$tooltip\n$(_n 'Recharge lists')" & (echo "action:tazbox su tazpanel pkgs#recharge" echo "tooltip:$tooltip" echo "icon:software-update-urgent") > $fifo @@ -90,6 +106,7 @@ # Too old packages list if [ -n "$mtime" ]; then tooltip="$(_ 'Your packages list is older than 10 days')" + notify "$tooltip\n$(_n 'Recharge lists')" & (echo "action:tazbox su tazpanel pkgs#recharge" echo "action:quit" echo "tooltip:$tooltip" @@ -103,6 +120,7 @@ 'There is %s upgradeable package' \ 'There are %s upgradeable packages' "$up" \ "$up")" + notify "$tooltip\n$(_n 'Check upgrade')" & (echo "action:tazbox su tazpanel pkgs#up" echo "tooltip:$tooltip" echo "icon:software-update-urgent") > $fifo @@ -111,6 +129,7 @@ # Nothing to do, close notification tooltip="$(_ 'System is up to date - %s' "$text")" + notify "$tooltip" 'info' & echo "tooltip:$tooltip" > $fifo sleep 10 echo "quit" > $fifo