Last active
May 31, 2017 04:07
-
-
Save au-phiware/c39958f5de65dfed45ea500d3f4d2a98 to your computer and use it in GitHub Desktop.
Example of using Notify OSD to display progress bar.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Standard icons can be found in /usr/share/icons /usr/share/notify-osd/icons | |
seq 100 | while read number | |
do | |
icon=$(( ${RANDOM: -1:1} + ${RANDOM: -1:1} + 1 )) | |
icon=$(ls /usr/share/icons/gnome/32x32/emotes | grep face | sed s/.png// | head -n $icon | tail -n 1) | |
notify-send -i $icon -h int:value:$number -h string:synchronous:my-progress "Progress" | |
sleep 0.3 | |
done | |
gdbus call --session \ | |
--dest org.freedesktop.Notifications \ | |
--object-path /org/freedesktop/Notifications \ | |
--method org.freedesktop.Notifications.Notify \ | |
my_app_name \ | |
42 \ | |
'utilities-terminal' \ | |
"Title $RANDOM" \ | |
'body' \ | |
'["action-name","Action"]' \ | |
'{}' \ | |
exec 3< <(dbus-monitor --session --monitor "interface=org.freedesktop.Notifications") | |
while read type time sender _1 destination props | |
do | |
eval $props | |
if [ "$type" == "signal" -a "$interface" == "org.freedesktop.Notifications" ] | |
then | |
if [ "$member" == "ActionInvoked" ] | |
then | |
read type id <&3 | |
read type action <&3 | |
echo $id $action | |
fi | |
[ "$member" == "NotificationClosed" ] && break | |
fi | |
done <&3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment