1#!/bin/bash 2 3function keypress { 4 echo "press enter to continue..." 5 read key 6} 7 8function basic_notifications { 9 ../../dunstify -a "dunst tester" "normal" "<i>italic body</i>" 10 ../../dunstify -a "dunst tester" -u c "critical" "<b>bold body</b>" 11 ../../dunstify -a "dunst tester" "long body" "This is a notification with a very long body" 12 ../../dunstify -a "dunst tester" "duplucate" 13 ../../dunstify -a "dunst tester" "duplucate" 14 ../../dunstify -a "dunst tester" "duplucate" 15 ../../dunstify -a "dunst tester" "url" "www.google.de" 16 17} 18 19function show_age { 20 echo "###################################" 21 echo "show age" 22 echo "###################################" 23 killall dunst 24 ../../dunst -config dunstrc.show_age & 25 ../../dunstify -a "dunst tester" -u c "Show Age" "These should print their age after 2 seconds" 26 basic_notifications 27 keypress 28} 29 30function run_script { 31 echo "###################################" 32 echo "run script" 33 echo "###################################" 34 killall dunst 35 PATH=".:$PATH" ../../dunst -config dunstrc.run_script & 36 ../../dunstify -a "dunst tester" -u c \ 37 "Run Script" "After Keypress, 2 other notification should pop up. THis needs notify-send installed" 38 keypress 39 ../../dunstify -a "dunst tester" -u c "trigger" "this should trigger a notification" 40 keypress 41} 42 43function ignore_newline { 44 echo "###################################" 45 echo "ignore newline" 46 echo "###################################" 47 killall dunst 48 ../../dunst -config dunstrc.ignore_newline_no_wrap & 49 ../../dunstify -a "dunst tester" -u c "Ignore Newline No Wrap" "There should be no newline anywhere" 50 ../../dunstify -a "dunst tester" -u c "Th\nis\n\n\n is\n fu\nll of \n" "\nnew\nlines" 51 basic_notifications 52 keypress 53 54 killall dunst 55 ../../dunst -config dunstrc.ignore_newline & 56 ../../dunstify -a "dunst tester" -u c "Ignore Newline" \ 57 "The only newlines you should encounter here are wordwraps. That's why I'm so long." 58 ../../dunstify -a "dunst tester" -u c "Th\nis\n\n\n is\n fu\nll of \n" "\nnew\nlines" 59 basic_notifications 60 keypress 61} 62 63function replace { 64 echo "###################################" 65 echo "replace" 66 echo "###################################" 67 killall dunst 68 ../../dunst -config dunstrc.default & 69 id=$(../../dunstify -a "dunst tester" -p "Replace" "this should get replaces after keypress") 70 keypress 71 ../../dunstify -a "dunst tester" -r $id "Success?" "I hope this is not a new notification" 72 keypress 73 74} 75 76function markup { 77 echo "###################################" 78 echo "markup" 79 echo "###################################" 80 killall dunst 81 ../../dunst -config dunstrc.markup "200x0+10+10" & 82 ../../dunstify -a "dunst tester" "Markup Tests" -u "c" 83 ../../dunstify -a "dunst tester" "There should be no markup in the title" -u "c" 84 ../../dunstify -a "dunst tester" "Title" "<b>bold</b> <i>italic</i>" 85 ../../dunstify -a "dunst tester" "Title" "<a href="github.com"> Github link </a>" 86 ../../dunstify -a "dunst tester" "Title" "<b>broken markup</i>" 87 keypress 88 89 killall dunst 90 ../../dunst -config dunstrc.nomarkup "200x0+10+10" & 91 ../../dunstify -a "dunst tester" -u c "No markup Tests" 92 ../../dunstify -a "dunst tester" "<b>Title</b>" "<b>bold</b><i>italic</i>" 93 ../../dunstify -a "dunst tester" "<b>Title</b>" "<b>broken markup</i>" 94 keypress 95 96} 97 98function corners { 99 echo "###################################" 100 echo "corners" 101 echo "###################################" 102 killall dunst 103 ../../dunst -config dunstrc.default -geom "200x0+10+10" & 104 ../../dunstify -a "dunst tester" -u c "upper left" 105 basic_notifications 106 keypress 107 108 killall dunst 109 ../../dunst -config dunstrc.default -geom "200x0-10+10" & 110 ../../dunstify -a "dunst tester" -u c "upper right" 111 basic_notifications 112 keypress 113 114 killall dunst 115 ../../dunst -config dunstrc.default -geom "200x0-10-10" & 116 ../../dunstify -a "dunst tester" -u c "lower right" 117 basic_notifications 118 keypress 119 120 killall dunst 121 ../../dunst -config dunstrc.default -geom "200x0+10-10" & 122 ../../dunstify -a "dunst tester" -u c "lower left" 123 basic_notifications 124 keypress 125 126} 127 128function geometry { 129 echo "###################################" 130 echo "geometry" 131 echo "###################################" 132 killall dunst 133 ../../dunst -config dunstrc.default -geom "0x0" & 134 ../../dunstify -a "dunst tester" -u c "0x0" 135 basic_notifications 136 keypress 137 138 139 killall dunst 140 ../../dunst -config dunstrc.default -geom "200x0" & 141 ../../dunstify -a "dunst tester" -u c "200x0" 142 basic_notifications 143 keypress 144 145 killall dunst 146 ../../dunst -config dunstrc.default -geom "200x2" & 147 ../../dunstify -a "dunst tester" -u c "200x2" 148 basic_notifications 149 keypress 150 151 killall dunst 152 ../../dunst -config dunstrc.default -geom "200x1" & 153 ../../dunstify -a "dunst tester" -u c "200x1" 154 basic_notifications 155 keypress 156 157 killall dunst 158 ../../dunst -config dunstrc.default -geom "0x1" & 159 ../../dunstify -a "dunst tester" -u c "0x1" 160 basic_notifications 161 keypress 162 163 killall dunst 164 ../../dunst -config dunstrc.default -geom "-300x1" & 165 ../../dunstify -a "dunst tester" -u c -- "-300x1" 166 basic_notifications 167 keypress 168 169 killall dunst 170 ../../dunst -config dunstrc.default -geom "-300x1-20-20" & 171 ../../dunstify -a "dunst tester" -u c -- "-300x1-20-20" 172 basic_notifications 173 keypress 174 175 killall dunst 176 ../../dunst -config dunstrc.default -geom "x1" & 177 ../../dunstify -a "dunst tester" -u c "x1-20-20" "across the screen" 178 basic_notifications 179 keypress 180} 181 182function progress_bar { 183 killall dunst 184 ../../dunst -config dunstrc.default & 185 ../../dunstify -h int:value:0 -a "dunst tester" -u c "Progress bar 0%: " 186 ../../dunstify -h int:value:33 -a "dunst tester" -u c "Progress bar 33%: " 187 ../../dunstify -h int:value:66 -a "dunst tester" -u c "Progress bar 66%: " 188 ../../dunstify -h int:value:100 -a "dunst tester" -u c "Progress bar 100%: " 189 keypress 190 killall dunst 191 ../../dunst -config dunstrc.default & 192 ../../dunstify -h int:value:33 -a "dunst tester" -u l "Low priority: " 193 ../../dunstify -h int:value:33 -a "dunst tester" -u n "Normal priority: " 194 ../../dunstify -h int:value:33 -a "dunst tester" -u c "Critical priority: " 195 keypress 196 killall dunst 197 ../../dunst -config dunstrc.progress_bar & 198 ../../dunstify -h int:value:33 -a "dunst tester" -u n "The progress bar should not be the entire width" 199 ../../dunstify -h int:value:33 -a "dunst tester" -u n "You might also notice height and frame size are changed" 200 ../../dunstify -h int:value:33 -a "dunst tester" -u c "Short" 201 keypress 202} 203 204if [ -n "$1" ]; then 205 while [ -n "$1" ]; do 206 $1 207 shift 208 done 209else 210 progress_bar 211 geometry 212 corners 213 show_age 214 run_script 215 ignore_newline 216 replace 217 markup 218fi 219 220killall dunst 221