Artifact
85b785a68e39e4aaa38ceb05fc936397620602da:
- File
net2o-notify.fs
— part of check-in
[b054ed8eae]
at
2015-12-25 23:16:01
on branch trunk
— Notification stuff
(user:
bernd
size: 5635)
0000: 5c 20 6e 65 74 32 6f 20 74 65 6d 70 6c 61 74 65 \ net2o template
0010: 20 66 6f 72 20 6e 65 77 20 66 69 6c 65 73 0a 0a for new files..
0020: 5c 20 43 6f 70 79 72 69 67 68 74 20 28 43 29 20 \ Copyright (C)
0030: 32 30 31 35 20 20 20 42 65 72 6e 64 20 50 61 79 2015 Bernd Pay
0040: 73 61 6e 0a 0a 5c 20 54 68 69 73 20 70 72 6f 67 san..\ This prog
0050: 72 61 6d 20 69 73 20 66 72 65 65 20 73 6f 66 74 ram is free soft
0060: 77 61 72 65 3a 20 79 6f 75 20 63 61 6e 20 72 65 ware: you can re
0070: 64 69 73 74 72 69 62 75 74 65 20 69 74 20 61 6e distribute it an
0080: 64 2f 6f 72 20 6d 6f 64 69 66 79 0a 5c 20 69 74 d/or modify.\ it
0090: 20 75 6e 64 65 72 20 74 68 65 20 74 65 72 6d 73 under the terms
00a0: 20 6f 66 20 74 68 65 20 47 4e 55 20 41 66 66 65 of the GNU Affe
00b0: 72 6f 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 ro General Publi
00c0: 63 20 4c 69 63 65 6e 73 65 20 61 73 20 70 75 62 c License as pub
00d0: 6c 69 73 68 65 64 20 62 79 0a 5c 20 74 68 65 20 lished by.\ the
00e0: 46 72 65 65 20 53 6f 66 74 77 61 72 65 20 46 6f Free Software Fo
00f0: 75 6e 64 61 74 69 6f 6e 2c 20 65 69 74 68 65 72 undation, either
0100: 20 76 65 72 73 69 6f 6e 20 33 20 6f 66 20 74 68 version 3 of th
0110: 65 20 4c 69 63 65 6e 73 65 2c 20 6f 72 0a 5c 20 e License, or.\
0120: 28 61 74 20 79 6f 75 72 20 6f 70 74 69 6f 6e 29 (at your option)
0130: 20 61 6e 79 20 6c 61 74 65 72 20 76 65 72 73 69 any later versi
0140: 6f 6e 2e 0a 0a 5c 20 54 68 69 73 20 70 72 6f 67 on...\ This prog
0150: 72 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 ram is distribut
0160: 65 64 20 69 6e 20 74 68 65 20 68 6f 70 65 20 74 ed in the hope t
0170: 68 61 74 20 69 74 20 77 69 6c 6c 20 62 65 20 75 hat it will be u
0180: 73 65 66 75 6c 2c 0a 5c 20 62 75 74 20 57 49 54 seful,.\ but WIT
0190: 48 4f 55 54 20 41 4e 59 20 57 41 52 52 41 4e 54 HOUT ANY WARRANT
01a0: 59 3b 20 77 69 74 68 6f 75 74 20 65 76 65 6e 20 Y; without even
01b0: 74 68 65 20 69 6d 70 6c 69 65 64 20 77 61 72 72 the implied warr
01c0: 61 6e 74 79 20 6f 66 0a 5c 20 4d 45 52 43 48 41 anty of.\ MERCHA
01d0: 4e 54 41 42 49 4c 49 54 59 20 6f 72 20 46 49 54 NTABILITY or FIT
01e0: 4e 45 53 53 20 46 4f 52 20 41 20 50 41 52 54 49 NESS FOR A PARTI
01f0: 43 55 4c 41 52 20 50 55 52 50 4f 53 45 2e 20 20 CULAR PURPOSE.
0200: 53 65 65 20 74 68 65 0a 5c 20 47 4e 55 20 41 66 See the.\ GNU Af
0210: 66 65 72 6f 20 47 65 6e 65 72 61 6c 20 50 75 62 fero General Pub
0220: 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f 72 20 lic License for
0230: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5c more details...\
0240: 20 59 6f 75 20 73 68 6f 75 6c 64 20 68 61 76 65 You should have
0250: 20 72 65 63 65 69 76 65 64 20 61 20 63 6f 70 79 received a copy
0260: 20 6f 66 20 74 68 65 20 47 4e 55 20 41 66 66 65 of the GNU Affe
0270: 72 6f 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 ro General Publi
0280: 63 20 4c 69 63 65 6e 73 65 0a 5c 20 61 6c 6f 6e c License.\ alon
0290: 67 20 77 69 74 68 20 74 68 69 73 20 70 72 6f 67 g with this prog
02a0: 72 61 6d 2e 20 20 49 66 20 6e 6f 74 2c 20 73 65 ram. If not, se
02b0: 65 20 3c 68 74 74 70 3a 2f 2f 77 77 77 2e 67 6e e <http://www.gn
02c0: 75 2e 6f 72 67 2f 6c 69 63 65 6e 73 65 73 2f 3e u.org/licenses/>
02d0: 2e 0a 0a 5c 20 6e 6f 74 69 66 69 63 61 74 69 6f ...\ notificatio
02e0: 6e 73 20 28 6f 6e 20 61 6e 64 72 6f 69 64 20 6f ns (on android o
02f0: 6e 6c 79 20 6e 6f 77 29 0a 0a 36 34 23 30 20 36 nly now)..64#0 6
0300: 34 56 61 6c 75 65 20 6c 61 73 74 2d 6e 6f 74 69 4Value last-noti
0310: 66 79 0a 36 34 23 30 20 36 34 56 61 6c 75 65 20 fy.64#0 64Value
0320: 6c 61 74 65 73 74 2d 6e 6f 74 69 66 79 0a 36 30 latest-notify.60
0330: 2e 30 30 30 30 30 30 30 30 30 20 64 3e 36 34 20 .000000000 d>64
0340: 36 34 56 61 6c 75 65 20 64 65 6c 74 61 2d 6e 6f 64Value delta-no
0350: 74 69 66 79 20 5c 20 6f 6e 65 20 6e 6f 74 69 66 tify \ one notif
0360: 69 63 61 74 69 6f 6e 20 70 65 72 20 6d 69 6e 75 ication per minu
0370: 74 65 20 69 73 20 65 6e 6f 75 67 68 0a 33 20 56 te is enough.3 V
0380: 61 6c 75 65 20 6e 6f 74 69 66 79 2d 6d 6f 64 65 alue notify-mode
0390: 0a 24 46 46 46 46 30 30 20 56 61 6c 75 65 20 6e .$FFFF00 Value n
03a0: 6f 74 69 66 79 2d 72 67 62 0a 35 30 30 20 56 61 otify-rgb.500 Va
03b0: 6c 75 65 20 6e 6f 74 69 66 79 2d 6f 6e 0a 34 35 lue notify-on.45
03c0: 30 30 20 56 61 6c 75 65 20 6e 6f 74 69 66 79 2d 00 Value notify-
03d0: 6f 66 66 0a 74 72 75 65 20 56 61 6c 75 65 20 6e off.true Value n
03e0: 6f 74 69 66 79 2d 74 65 78 74 0a 0a 3a 20 74 69 otify-text..: ti
03f0: 63 6b 2d 6e 6f 74 69 66 79 3f 20 28 20 2d 2d 20 ck-notify? ( --
0400: 66 6c 61 67 20 29 0a 20 20 20 20 74 69 63 6b 73 flag ). ticks
0410: 20 6c 61 73 74 2d 6e 6f 74 69 66 79 20 36 34 2d last-notify 64-
0420: 20 64 65 6c 74 61 2d 6e 6f 74 69 66 79 20 36 34 delta-notify 64
0430: 3c 20 3b 0a 56 61 72 69 61 62 6c 65 20 6e 6f 74 < ;.Variable not
0440: 69 66 79 3f 20 2d 32 20 6e 6f 74 69 66 79 3f 20 ify? -2 notify?
0450: 21 20 5c 20 64 65 66 61 75 6c 74 3a 20 6e 6f 20 ! \ default: no
0460: 6e 6f 74 69 66 69 63 61 74 69 6f 6e 20 77 68 65 notification whe
0470: 6e 20 61 63 74 69 76 65 0a 56 61 72 69 61 62 6c n active.Variabl
0480: 65 20 6e 6f 74 69 66 79 24 0a 56 61 72 69 61 62 e notify$.Variab
0490: 6c 65 20 70 65 6e 64 69 6e 67 2d 6e 6f 74 69 66 le pending-notif
04a0: 69 63 61 74 69 6f 6e 73 0a 0a 53 65 6d 61 20 6e ications..Sema n
04b0: 6f 74 69 66 79 2d 73 65 6d 61 0a 3a 20 6e 6f 74 otify-sema.: not
04c0: 69 66 79 3b 20 6e 69 70 20 28 3b 5d 29 20 5d 5d ify; nip (;]) ]]
04d0: 20 6e 6f 74 69 66 79 2d 73 65 6d 61 20 63 2d 73 notify-sema c-s
04e0: 65 63 74 69 6f 6e 20 3b 20 5b 5b 20 3b 0a 3a 20 ection ; [[ ;.:
04f0: 6e 6f 74 69 66 79 3e 20 63 6f 6d 70 2d 5b 3a 20 notify> comp-[:
0500: 5b 27 5d 20 6e 6f 74 69 66 79 3b 20 63 6f 6c 6f ['] notify; colo
0510: 6e 2d 73 79 73 2d 78 74 2d 6f 66 66 73 65 74 20 n-sys-xt-offset
0520: 73 74 69 63 6b 20 3b 20 69 6d 6d 65 64 69 61 74 stick ; immediat
0530: 65 0a 0a 3a 20 6e 6f 74 69 66 79 2d 74 69 74 6c e..: notify-titl
0540: 65 20 28 20 2d 2d 20 29 0a 20 20 20 20 2e 22 20 e ( -- ). ."
0550: 6e 65 74 32 6f 3a 20 22 20 70 65 6e 64 69 6e 67 net2o: " pending
0560: 2d 6e 6f 74 69 66 69 63 61 74 69 6f 6e 73 20 40 -notifications @
0570: 20 64 75 70 20 2e 0a 20 20 20 20 2e 22 20 4d 65 dup .. ." Me
0580: 73 73 61 67 65 22 20 31 20 3e 20 49 46 20 2e 22 ssage" 1 > IF ."
0590: 20 73 22 20 20 54 48 45 4e 20 3b 0a 0a 5b 49 46 s" THEN ;..[IF
05a0: 44 45 46 5d 20 61 6e 64 72 6f 69 64 0a 20 20 20 DEF] android.
05b0: 20 61 6c 73 6f 20 61 6e 64 72 6f 69 64 20 61 6c also android al
05c0: 73 6f 20 6a 6e 69 0a 0a 20 20 20 20 5c 20 30 78 so jni.. \ 0x
05d0: 30 31 30 38 30 30 37 37 20 56 61 6c 75 65 20 6e 01080077 Value n
05e0: 65 74 32 6f 2d 69 63 6f 6e 23 20 5c 20 64 65 66 et2o-icon# \ def
05f0: 61 75 6c 74 0a 20 20 20 20 3a 20 6e 65 74 32 6f ault. : net2o
0600: 2d 69 63 6f 6e 23 20 22 67 6e 75 2e 67 66 6f 72 -icon# "gnu.gfor
0610: 74 68 3a 64 72 61 77 61 62 6c 65 2f 6e 65 74 32 th:drawable/net2
0620: 6f 5f 6e 6f 74 69 66 79 22 20 52 2e 69 64 20 3b o_notify" R.id ;
0630: 0a 20 20 20 20 6a 76 61 6c 75 65 20 6e 62 0a 20 . jvalue nb.
0640: 20 20 20 6a 76 61 6c 75 65 20 6e 69 0a 20 20 20 jvalue ni.
0650: 20 6a 76 61 6c 75 65 20 6e 66 0a 20 20 20 20 6a jvalue nf. j
0660: 76 61 6c 75 65 20 6e 6f 74 69 66 69 63 61 74 69 value notificati
0670: 6f 6e 2d 6d 61 6e 61 67 65 72 0a 20 20 20 20 3a on-manager. :
0680: 20 6e 6f 74 69 66 79 2b 20 28 20 61 64 64 72 20 notify+ ( addr
0690: 75 20 2d 2d 20 29 20 20 6e 6f 74 69 66 79 3e 20 u -- ) notify>
06a0: 6e 6f 74 69 66 79 24 20 24 2b 21 20 3b 0a 20 20 notify$ $+! ;.
06b0: 20 20 3a 20 6e 6f 74 69 66 79 21 20 28 20 61 64 : notify! ( ad
06c0: 64 72 20 75 20 2d 2d 20 29 20 20 6e 6f 74 69 66 dr u -- ) notif
06d0: 79 3e 20 6e 6f 74 69 66 79 24 20 24 21 20 3b 0a y> notify$ $! ;.
06e0: 20 20 20 20 3a 20 6e 6f 74 69 66 79 40 20 28 20 : notify@ (
06f0: 2d 2d 20 61 64 64 72 20 75 20 29 0a 09 6e 6f 74 -- addr u )..not
0700: 69 66 79 2d 74 65 78 74 20 49 46 20 20 6e 6f 74 ify-text IF not
0710: 69 66 79 24 20 24 40 0a 09 45 4c 53 45 20 20 22 ify$ $@..ELSE "
0720: 68 69 64 64 65 6e 20 63 72 79 70 74 69 63 20 74 hidden cryptic t
0730: 65 78 74 22 20 20 54 48 45 4e 20 3b 0a 0a 20 20 ext" THEN ;..
0740: 20 20 3a 20 3f 6e 6d 20 28 20 2d 2d 20 29 0a 09 : ?nm ( -- )..
0750: 6e 6f 74 69 66 69 63 61 74 69 6f 6e 2d 6d 61 6e notification-man
0760: 61 67 65 72 20 30 3d 20 49 46 0a 09 20 20 20 20 ager 0= IF..
0770: 4e 4f 54 49 46 49 43 41 54 49 4f 4e 5f 53 45 52 NOTIFICATION_SER
0780: 56 49 43 45 20 63 6c 61 7a 7a 20 2e 67 65 74 53 VICE clazz .getS
0790: 79 73 74 65 6d 53 65 72 76 69 63 65 0a 09 20 20 ystemService..
07a0: 20 20 74 6f 20 6e 6f 74 69 66 69 63 61 74 69 6f to notificatio
07b0: 6e 2d 6d 61 6e 61 67 65 72 0a 09 54 48 45 4e 20 n-manager..THEN
07c0: 3b 0a 20 20 20 20 3a 20 3f 6e 69 20 28 20 2d 2d ;. : ?ni ( --
07d0: 20 29 0a 09 6e 69 20 30 3d 20 49 46 20 20 63 6c )..ni 0= IF cl
07e0: 61 7a 7a 20 2e 67 66 6f 72 74 68 69 6e 74 65 6e azz .gforthinten
07f0: 74 20 74 6f 20 6e 69 20 20 54 48 45 4e 20 3b 0a t to ni THEN ;.
0800: 20 20 20 20 3a 20 6d 73 67 2d 62 75 69 6c 64 65 : msg-builde
0810: 72 20 28 20 2d 2d 20 29 20 3f 6e 6d 20 3f 6e 69 r ( -- ) ?nm ?ni
0820: 0a 09 63 6c 61 7a 7a 20 6e 65 77 4e 6f 74 69 66 ..clazz newNotif
0830: 69 63 61 74 69 6f 6e 2e 42 75 69 6c 64 65 72 20 ication.Builder
0840: 74 6f 20 6e 62 0a 09 6e 6f 74 69 66 79 2d 72 67 to nb..notify-rg
0850: 62 20 6e 6f 74 69 66 79 2d 6f 6e 20 6e 6f 74 69 b notify-on noti
0860: 66 79 2d 6f 66 66 20 6e 62 20 2e 73 65 74 4c 69 fy-off nb .setLi
0870: 67 68 74 73 20 74 6f 20 6e 62 0a 09 6e 6f 74 69 ghts to nb..noti
0880: 66 79 2d 6d 6f 64 65 20 6e 62 20 2e 73 65 74 44 fy-mode nb .setD
0890: 65 66 61 75 6c 74 73 20 74 6f 20 6e 62 0a 09 6e efaults to nb..n
08a0: 69 20 6e 62 20 2e 73 65 74 43 6f 6e 74 65 6e 74 i nb .setContent
08b0: 49 6e 74 65 6e 74 20 74 6f 20 6e 62 0a 09 31 20 Intent to nb..1
08c0: 6e 62 20 2e 73 65 74 41 75 74 6f 43 61 6e 63 65 nb .setAutoCance
08d0: 6c 20 74 6f 20 6e 62 20 3b 0a 20 20 20 20 6d 73 l to nb ;. ms
08e0: 67 2d 62 75 69 6c 64 65 72 0a 20 20 20 20 3a 20 g-builder. :
08f0: 62 75 69 6c 64 2d 6e 6f 74 69 66 69 63 61 74 69 build-notificati
0900: 6f 6e 20 28 20 2d 2d 20 29 0a 09 31 20 70 65 6e on ( -- )..1 pen
0910: 64 69 6e 67 2d 6e 6f 74 69 66 69 63 61 74 69 6f ding-notificatio
0920: 6e 73 20 2b 21 0a 09 5b 27 5d 20 6e 6f 74 69 66 ns +!..['] notif
0930: 79 2d 74 69 74 6c 65 20 24 74 6d 70 20 6d 61 6b y-title $tmp mak
0940: 65 2d 6a 73 74 72 69 6e 67 20 6e 62 20 2e 73 65 e-jstring nb .se
0950: 74 43 6f 6e 74 65 6e 74 54 69 74 6c 65 20 74 6f tContentTitle to
0960: 20 6e 62 0a 09 6e 6f 74 69 66 79 40 20 6d 61 6b nb..notify@ mak
0970: 65 2d 6a 73 74 72 69 6e 67 20 6e 62 20 2e 73 65 e-jstring nb .se
0980: 74 43 6f 6e 74 65 6e 74 54 65 78 74 20 74 6f 20 tContentText to
0990: 6e 62 0a 09 6e 6f 74 69 66 79 40 20 6d 61 6b 65 nb..notify@ make
09a0: 2d 6a 73 74 72 69 6e 67 20 6e 62 20 2e 73 65 74 -jstring nb .set
09b0: 54 69 63 6b 65 72 20 74 6f 20 6e 62 0a 09 6e 65 Ticker to nb..ne
09c0: 74 32 6f 2d 69 63 6f 6e 23 20 6e 62 20 2e 73 65 t2o-icon# nb .se
09d0: 74 53 6d 61 6c 6c 49 63 6f 6e 20 74 6f 20 6e 62 tSmallIcon to nb
09e0: 0a 09 6e 62 20 2e 62 75 69 6c 64 20 74 6f 20 6e ..nb .build to n
09f0: 66 20 3b 0a 20 20 20 20 3a 20 73 68 6f 77 2d 6e f ;. : show-n
0a00: 6f 74 69 66 69 63 61 74 69 6f 6e 20 28 20 2d 2d otification ( --
0a10: 20 29 0a 09 31 20 6e 66 20 6e 6f 74 69 66 69 63 )..1 nf notific
0a20: 61 74 69 6f 6e 2d 6d 61 6e 61 67 65 72 20 2e 6e ation-manager .n
0a30: 6f 74 69 66 79 0a 09 31 30 30 30 20 63 6c 61 7a otify..1000 claz
0a40: 7a 20 2e 73 63 72 65 65 6e 5f 6f 6e 20 3b 0a 5b z .screen_on ;.[
0a50: 45 4c 53 45 5d 0a 20 20 20 20 3a 20 65 73 63 61 ELSE]. : esca
0a60: 70 65 2d 3c 26 3e 20 28 20 61 64 64 72 20 75 20 pe-<&> ( addr u
0a70: 2d 2d 20 29 0a 09 62 6f 75 6e 64 73 20 3f 44 4f -- )..bounds ?DO
0a80: 20 20 63 61 73 65 20 69 20 63 40 0a 09 09 27 3c case i c@...'<
0a90: 27 20 6f 66 20 20 2e 22 20 26 6c 74 3b 22 20 20 ' of ." <"
0aa0: 65 6e 64 6f 66 0a 09 09 27 3e 27 20 6f 66 20 20 endof...'>' of
0ab0: 2e 22 20 26 67 74 3b 22 20 20 65 6e 64 6f 66 0a ." >" endof.
0ac0: 09 09 27 26 27 20 6f 66 20 20 2e 22 20 26 61 6d ..'&' of ." &am
0ad0: 70 3b 22 20 65 6e 64 6f 66 0a 09 09 64 65 66 61 p;" endof...defa
0ae0: 75 6c 74 3a 20 65 6d 69 74 20 20 65 6e 64 63 61 ult: emit endca
0af0: 73 65 20 20 4c 4f 4f 50 20 3b 0a 20 20 20 20 0a se LOOP ;. .
0b00: 20 20 20 20 3a 20 6e 6f 74 69 66 79 2b 20 6e 6f : notify+ no
0b10: 74 69 66 79 3e 20 6e 6f 74 69 66 79 24 20 24 2b tify> notify$ $+
0b20: 21 20 3b 0a 20 20 20 20 3a 20 6e 6f 74 69 66 79 ! ;. : notify
0b30: 21 20 6e 6f 74 69 66 79 3e 20 6e 6f 74 69 66 79 ! notify> notify
0b40: 24 20 24 21 20 3b 0a 20 20 20 20 3a 20 62 75 69 $ $! ;. : bui
0b50: 6c 64 2d 6e 6f 74 69 66 69 63 61 74 69 6f 6e 20 ld-notification
0b60: 28 20 2d 2d 20 29 20 3b 0a 20 20 20 20 3a 20 6e ( -- ) ;. : n
0b70: 6f 74 69 66 79 40 20 28 20 2d 2d 20 61 64 64 72 otify@ ( -- addr
0b80: 20 75 20 29 0a 09 6e 6f 74 69 66 79 2d 74 65 78 u )..notify-tex
0b90: 74 20 49 46 20 20 6e 6f 74 69 66 79 24 20 24 40 t IF notify$ $@
0ba0: 20 5b 27 5d 20 65 73 63 61 70 65 2d 3c 26 3e 20 ['] escape-<&>
0bb0: 24 74 6d 70 0a 09 45 4c 53 45 20 20 22 3c 69 3e $tmp..ELSE "<i>
0bc0: 68 69 64 64 65 6e 20 63 72 79 70 74 69 63 20 74 hidden cryptic t
0bd0: 65 78 74 3c 2f 69 3e 22 20 20 54 48 45 4e 20 3b ext</i>" THEN ;
0be0: 0a 0a 20 20 20 20 5b 49 46 44 45 46 5d 20 6c 69 .. [IFDEF] li
0bf0: 6e 75 78 0a 09 5b 49 46 44 45 46 5d 20 66 6f 72 nux..[IFDEF] for
0c00: 6b 2b 65 78 65 63 0a 09 20 20 20 20 56 61 72 69 k+exec.. Vari
0c10: 61 62 6c 65 20 6e 6f 74 69 66 79 2d 73 65 6e 64 able notify-send
0c20: 20 20 24 31 30 30 30 20 6e 6f 74 69 66 79 2d 73 $1000 notify-s
0c30: 65 6e 64 20 24 21 6c 65 6e 0a 09 20 20 20 20 73 end $!len.. s
0c40: 22 20 77 68 69 63 68 20 6e 6f 74 69 66 79 2d 73 " which notify-s
0c50: 65 6e 64 22 20 72 2f 6f 20 6f 70 65 6e 2d 70 69 end" r/o open-pi
0c60: 70 65 20 74 68 72 6f 77 0a 09 20 20 20 20 3e 72 pe throw.. >r
0c70: 20 6e 6f 74 69 66 79 2d 73 65 6e 64 20 24 40 20 notify-send $@
0c80: 72 40 20 72 65 61 64 2d 66 69 6c 65 20 74 68 72 r@ read-file thr
0c90: 6f 77 20 72 3e 20 63 6c 6f 73 65 2d 66 69 6c 65 ow r> close-file
0ca0: 20 74 68 72 6f 77 0a 09 20 20 20 20 6e 6f 74 69 throw.. noti
0cb0: 66 79 2d 73 65 6e 64 20 24 40 20 72 6f 74 20 75 fy-send $@ rot u
0cc0: 6d 69 6e 20 23 6c 66 20 2d 73 6b 69 70 20 6e 6f min #lf -skip no
0cd0: 74 69 66 79 2d 73 65 6e 64 20 24 21 6c 65 6e 20 tify-send $!len
0ce0: 20 64 72 6f 70 0a 09 20 20 20 20 0a 09 20 20 20 drop.. ..
0cf0: 20 56 61 72 69 61 62 6c 65 20 6e 65 74 32 6f 2d Variable net2o-
0d00: 6c 6f 67 6f 0a 09 20 20 20 20 73 22 20 64 6f 63 logo.. s" doc
0d10: 2f 6e 65 74 32 6f 2d 6c 6f 67 6f 2e 70 6e 67 22 /net2o-logo.png"
0d20: 20 6f 70 65 6e 2d 66 70 61 74 68 2d 66 69 6c 65 open-fpath-file
0d30: 20 30 3d 20 5b 49 46 5d 0a 09 09 72 6f 74 20 63 0= [IF]...rot c
0d40: 6c 6f 73 65 2d 66 69 6c 65 20 74 68 72 6f 77 0a lose-file throw.
0d50: 09 09 6f 76 65 72 20 63 40 20 27 2f 27 20 3c 3e ..over c@ '/' <>
0d60: 20 5b 49 46 5d 0a 09 09 20 20 20 20 70 61 64 20 [IF]... pad
0d70: 24 32 30 30 20 67 65 74 2d 64 69 72 20 6e 65 74 $200 get-dir net
0d80: 32 6f 2d 6c 6f 67 6f 20 24 21 20 27 2f 27 20 6e 2o-logo $! '/' n
0d90: 65 74 32 6f 2d 6c 6f 67 6f 20 63 24 2b 21 0a 09 et2o-logo c$+!..
0da0: 09 5b 54 48 45 4e 5d 0a 09 09 6e 65 74 32 6f 2d .[THEN]...net2o-
0db0: 6c 6f 67 6f 20 24 2b 21 0a 09 20 20 20 20 5b 54 logo $+!.. [T
0dc0: 48 45 4e 5d 0a 09 20 20 20 20 0a 09 20 20 20 20 HEN].. ..
0dd0: 3a 20 30 73 74 72 69 6e 67 20 28 20 61 64 64 72 : 0string ( addr
0de0: 20 75 20 2d 2d 20 63 73 74 72 20 29 0a 09 09 31 u -- cstr )...1
0df0: 2b 20 73 61 76 65 2d 6d 65 6d 20 6f 76 65 72 20 + save-mem over
0e00: 2b 20 31 2d 20 30 20 73 77 61 70 20 63 21 20 3b + 1- 0 swap c! ;
0e10: 0a 09 20 20 20 20 0a 09 20 20 20 20 43 72 65 61 .. .. Crea
0e20: 74 65 20 6e 6f 74 69 66 79 2d 61 72 67 73 0a 09 te notify-args..
0e30: 20 20 20 20 22 6e 6f 74 69 66 79 2d 73 65 6e 64 "notify-send
0e40: 5c 30 22 20 64 72 6f 70 20 2c 0a 09 20 20 20 20 \0" drop ,..
0e50: 22 2d 61 5c 30 22 20 64 72 6f 70 20 2c 0a 09 20 "-a\0" drop ,..
0e60: 20 20 20 22 6e 65 74 32 6f 5c 30 22 20 64 72 6f "net2o\0" dro
0e70: 70 20 2c 0a 09 20 20 20 20 22 2d 63 5c 30 22 20 p ,.. "-c\0"
0e80: 64 72 6f 70 20 2c 0a 09 20 20 20 20 22 69 6d 2e drop ,.. "im.
0e90: 72 65 63 65 69 76 65 64 5c 30 22 20 64 72 6f 70 received\0" drop
0ea0: 20 2c 0a 09 20 20 20 20 6e 65 74 32 6f 2d 6c 6f ,.. net2o-lo
0eb0: 67 6f 20 24 40 6c 65 6e 20 5b 49 46 5d 0a 09 09 go $@len [IF]...
0ec0: 22 2d 69 5c 30 22 20 64 72 6f 70 20 2c 0a 09 09 "-i\0" drop ,...
0ed0: 6e 65 74 32 6f 2d 6c 6f 67 6f 20 24 40 20 30 73 net2o-logo $@ 0s
0ee0: 74 72 69 6e 67 20 2c 0a 09 20 20 20 20 5b 54 48 tring ,.. [TH
0ef0: 45 4e 5d 0a 09 20 20 20 20 68 65 72 65 20 30 20 EN].. here 0
0f00: 2c 0a 09 20 20 20 20 68 65 72 65 20 30 20 2c 0a ,.. here 0 ,.
0f10: 09 20 20 20 20 30 20 2c 20 5c 20 6d 75 73 74 20 . 0 , \ must
0f20: 62 65 20 74 65 72 6d 69 6e 61 74 65 64 20 62 79 be terminated by
0f30: 20 6e 75 6c 6c 20 70 6f 69 6e 74 65 72 0a 09 20 null pointer..
0f40: 20 20 20 43 6f 6e 73 74 61 6e 74 20 63 6f 6e 74 Constant cont
0f50: 65 6e 74 2d 73 74 72 69 6e 67 0a 09 20 20 20 20 ent-string..
0f60: 43 6f 6e 73 74 61 6e 74 20 74 69 74 6c 65 2d 73 Constant title-s
0f70: 74 72 69 6e 67 0a 09 20 20 20 20 0a 09 20 20 20 tring.. ..
0f80: 20 3a 20 6c 69 6e 75 78 2d 6e 6f 74 69 66 69 63 : linux-notific
0f90: 61 74 69 6f 6e 20 28 20 2d 2d 20 29 20 20 6e 6f ation ( -- ) no
0fa0: 74 69 66 79 2d 73 65 6e 64 20 24 40 6c 65 6e 20 tify-send $@len
0fb0: 30 3d 20 3f 45 58 49 54 0a 09 09 74 69 74 6c 65 0= ?EXIT...title
0fc0: 2d 73 74 72 69 6e 67 20 30 20 3f 66 72 65 65 20 -string 0 ?free
0fd0: 20 63 6f 6e 74 65 6e 74 2d 73 74 72 69 6e 67 20 content-string
0fe0: 30 20 3f 66 72 65 65 0a 09 09 5b 27 5d 20 6e 6f 0 ?free...['] no
0ff0: 74 69 66 79 2d 74 69 74 6c 65 20 24 74 6d 70 20 tify-title $tmp
1000: 30 73 74 72 69 6e 67 20 74 69 74 6c 65 2d 73 74 0string title-st
1010: 72 69 6e 67 20 21 0a 09 09 6e 6f 74 69 66 79 40 ring !...notify@
1020: 20 30 73 74 72 69 6e 67 20 63 6f 6e 74 65 6e 74 0string content
1030: 2d 73 74 72 69 6e 67 20 21 0a 09 09 6e 6f 74 69 -string !...noti
1040: 66 79 2d 73 65 6e 64 20 24 40 20 6e 6f 74 69 66 fy-send $@ notif
1050: 79 2d 61 72 67 73 20 66 6f 72 6b 2b 65 78 65 63 y-args fork+exec
1060: 20 3b 0a 09 5b 45 4c 53 45 5d 0a 09 20 20 20 20 ;..[ELSE]..
1070: 3a 20 6c 69 6e 75 78 2d 6e 6f 74 69 66 69 63 61 : linux-notifica
1080: 74 69 6f 6e 20 28 20 2d 2d 20 29 20 5c 20 73 68 tion ( -- ) \ sh
1090: 65 6c 6c 20 73 63 72 69 70 74 20 62 61 73 65 64 ell script based
10a0: 0a 09 09 5b 20 73 22 20 77 68 69 63 68 20 6e 6f ...[ s" which no
10b0: 74 69 66 79 2d 73 65 6e 64 20 3e 2f 64 65 76 2f tify-send >/dev/
10c0: 6e 75 6c 6c 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c null 2>/dev/null
10d0: 22 20 73 79 73 74 65 6d 0a 09 09 24 3f 20 30 3d " system...$? 0=
10e0: 20 5d 20 5b 49 46 5d 0a 09 09 20 20 20 20 5b 3a ] [IF]... [:
10f0: 20 2e 5c 22 20 6e 6f 74 69 66 79 2d 73 65 6e 64 .\" notify-send
1100: 20 2d 61 20 6e 65 74 32 6f 20 2d 63 20 69 6d 2e -a net2o -c im.
1110: 72 65 63 65 69 76 65 64 20 22 0a 09 09 09 5b 20 received "....[
1120: 73 22 20 64 6f 63 2f 6e 65 74 32 6f 2d 6c 6f 67 s" doc/net2o-log
1130: 6f 2e 70 6e 67 22 20 6f 70 65 6e 2d 66 70 61 74 o.png" open-fpat
1140: 68 2d 66 69 6c 65 20 30 3d 20 5d 20 5b 49 46 5d h-file 0= ] [IF]
1150: 0a 09 09 09 20 20 20 20 2e 22 20 2d 69 20 22 20 .... ." -i "
1160: 5b 20 6f 76 65 72 20 63 40 20 27 2f 27 20 3c 3e [ over c@ '/' <>
1170: 20 5b 49 46 5d 0a 09 09 09 09 70 61 64 20 24 32 [IF].....pad $2
1180: 30 30 20 67 65 74 2d 64 69 72 20 5d 20 73 6c 69 00 get-dir ] sli
1190: 74 65 72 61 6c 20 74 79 70 65 20 2e 22 20 2f 22 teral type ." /"
11a0: 20 5b 0a 09 09 09 20 20 20 20 5b 54 48 45 4e 5d [.... [THEN]
11b0: 0a 09 09 09 20 20 20 20 5d 20 73 6c 69 74 65 72 .... ] sliter
11c0: 61 6c 20 27 74 79 70 65 27 20 5b 20 63 6c 6f 73 al 'type' [ clos
11d0: 65 2d 66 69 6c 65 20 74 68 72 6f 77 20 5d 0a 09 e-file throw ]..
11e0: 09 09 5b 54 48 45 4e 5d 0a 09 09 09 2e 22 20 20 ..[THEN]....."
11f0: 27 22 20 6e 6f 74 69 66 79 2d 74 69 74 6c 65 20 '" notify-title
1200: 2e 22 20 27 20 22 20 0a 09 09 09 6e 6f 74 69 66 ." ' " ....notif
1210: 79 40 20 27 74 79 70 65 27 20 3b 5d 20 24 74 6d y@ 'type' ;] $tm
1220: 70 20 73 79 73 74 65 6d 0a 09 09 5b 54 48 45 4e p system...[THEN
1230: 5d 20 3b 0a 09 5b 54 48 45 4e 5d 0a 20 20 20 20 ] ;..[THEN].
1240: 5b 54 48 45 4e 5d 0a 09 0a 20 20 20 20 3a 20 73 [THEN]... : s
1250: 68 6f 77 2d 6e 6f 74 69 66 69 63 61 74 69 6f 6e how-notification
1260: 20 28 20 2d 2d 20 29 0a 09 31 20 70 65 6e 64 69 ( -- )..1 pendi
1270: 6e 67 2d 6e 6f 74 69 66 69 63 61 74 69 6f 6e 73 ng-notifications
1280: 20 2b 21 0a 09 5b 49 46 44 45 46 5d 20 6c 69 6e +!..[IFDEF] lin
1290: 75 78 2d 6e 6f 74 69 66 69 63 61 74 69 6f 6e 0a ux-notification.
12a0: 09 20 20 20 20 6c 69 6e 75 78 2d 6e 6f 74 69 66 . linux-notif
12b0: 69 63 61 74 69 6f 6e 0a 09 5b 54 48 45 4e 5d 20 ication..[THEN]
12c0: 3b 0a 20 20 20 20 3a 20 6d 73 67 2d 62 75 69 6c ;. : msg-buil
12d0: 64 65 72 20 3b 0a 20 20 20 20 5b 49 46 55 4e 44 der ;. [IFUND
12e0: 45 46 5d 20 72 65 6e 64 65 72 69 6e 67 0a 09 56 EF] rendering..V
12f0: 61 72 69 61 62 6c 65 20 72 65 6e 64 65 72 69 6e ariable renderin
1300: 67 20 20 2d 31 20 72 65 6e 64 65 72 69 6e 67 20 g -1 rendering
1310: 21 0a 20 20 20 20 5b 54 48 45 4e 5d 0a 20 20 20 !. [THEN].
1320: 20 61 6c 73 6f 20 61 6c 73 6f 0a 5b 54 48 45 4e also also.[THEN
1330: 5d 0a 0a 3a 20 6e 6f 74 69 66 79 2d 20 28 20 2d ]..: notify- ( -
1340: 2d 20 29 0a 20 20 20 20 70 65 6e 64 69 6e 67 2d - ). pending-
1350: 6e 6f 74 69 66 69 63 61 74 69 6f 6e 73 20 6f 66 notifications of
1360: 66 0a 20 20 20 20 36 34 23 30 20 74 6f 20 6c 61 f. 64#0 to la
1370: 73 74 2d 6e 6f 74 69 66 79 20 3b 0a 0a 3a 20 6d st-notify ;..: m
1380: 73 67 2d 6e 6f 74 69 66 79 20 28 20 2d 2d 20 29 sg-notify ( -- )
1390: 20 6e 6f 74 69 66 79 3e 0a 20 20 20 20 74 69 63 notify>. tic
13a0: 6b 73 20 74 6f 20 6c 61 74 65 73 74 2d 6e 6f 74 ks to latest-not
13b0: 69 66 79 0a 20 20 20 20 72 65 6e 64 65 72 69 6e ify. renderin
13c0: 67 20 40 20 6e 6f 74 69 66 79 3f 20 40 20 3c 3d g @ notify? @ <=
13d0: 20 64 75 70 20 49 46 0a 09 6e 6f 74 69 66 79 2d dup IF..notify-
13e0: 0a 20 20 20 20 54 48 45 4e 0a 20 20 20 20 74 69 . THEN. ti
13f0: 63 6b 2d 6e 6f 74 69 66 79 3f 20 6f 72 20 30 3d ck-notify? or 0=
1400: 20 49 46 0a 09 62 75 69 6c 64 2d 6e 6f 74 69 66 IF..build-notif
1410: 69 63 61 74 69 6f 6e 20 73 68 6f 77 2d 6e 6f 74 ication show-not
1420: 69 66 69 63 61 74 69 6f 6e 0a 09 74 69 63 6b 73 ification..ticks
1430: 20 74 6f 20 6c 61 73 74 2d 6e 6f 74 69 66 79 0a to last-notify.
1440: 20 20 20 20 54 48 45 4e 20 20 6e 6f 74 69 66 79 THEN notify
1450: 24 20 24 6f 66 66 20 3b 0a 0a 70 72 65 76 69 6f $ $off ;..previo
1460: 75 73 20 70 72 65 76 69 6f 75 73 0a 0a 30 20 5b us previous..0 [
1470: 49 46 5d 0a 4c 6f 63 61 6c 20 56 61 72 69 61 62 IF].Local Variab
1480: 6c 65 73 3a 0a 66 6f 72 74 68 2d 6c 6f 63 61 6c les:.forth-local
1490: 2d 77 6f 72 64 73 3a 0a 20 20 20 20 28 0a 20 20 -words:. (.
14a0: 20 20 20 28 28 22 6e 65 74 32 6f 3a 22 20 22 2b (("net2o:" "+
14b0: 6e 65 74 32 6f 3a 22 29 20 64 65 66 69 6e 69 74 net2o:") definit
14c0: 69 6f 6e 2d 73 74 61 72 74 65 72 20 28 66 6f 6e ion-starter (fon
14d0: 74 2d 6c 6f 63 6b 2d 6b 65 79 77 6f 72 64 2d 66 t-lock-keyword-f
14e0: 61 63 65 20 2e 20 31 29 0a 20 20 20 20 20 20 22 ace . 1). "
14f0: 5b 20 5c 74 5c 6e 5d 22 20 74 20 6e 61 6d 65 20 [ \t\n]" t name
1500: 28 66 6f 6e 74 2d 6c 6f 63 6b 2d 66 75 6e 63 74 (font-lock-funct
1510: 69 6f 6e 2d 6e 61 6d 65 2d 66 61 63 65 20 2e 20 ion-name-face .
1520: 33 29 29 0a 20 20 20 20 20 28 22 5b 61 2d 7a 30 3)). ("[a-z0
1530: 2d 39 5d 2b 28 22 20 69 6d 6d 65 64 69 61 74 65 -9]+(" immediate
1540: 20 28 66 6f 6e 74 2d 6c 6f 63 6b 2d 63 6f 6d 6d (font-lock-comm
1550: 65 6e 74 2d 66 61 63 65 20 2e 20 31 29 0a 20 20 ent-face . 1).
1560: 20 20 20 20 22 29 22 20 6e 69 6c 20 63 6f 6d 6d ")" nil comm
1570: 65 6e 74 20 28 66 6f 6e 74 2d 6c 6f 63 6b 2d 63 ent (font-lock-c
1580: 6f 6d 6d 65 6e 74 2d 66 61 63 65 20 2e 20 31 29 omment-face . 1)
1590: 29 0a 20 20 20 20 29 0a 66 6f 72 74 68 2d 6c 6f ). ).forth-lo
15a0: 63 61 6c 2d 69 6e 64 65 6e 74 2d 77 6f 72 64 73 cal-indent-words
15b0: 3a 0a 20 20 20 20 28 0a 20 20 20 20 20 28 28 22 :. (. (("
15c0: 6e 65 74 32 6f 3a 22 20 22 2b 6e 65 74 32 6f 3a net2o:" "+net2o:
15d0: 22 29 20 28 30 20 2e 20 32 29 20 28 30 20 2e 20 ") (0 . 2) (0 .
15e0: 32 29 20 6e 6f 6e 2d 69 6d 6d 65 64 69 61 74 65 2) non-immediate
15f0: 29 0a 20 20 20 20 29 0a 45 6e 64 3a 0a 5b 54 48 ). ).End:.[TH
1600: 45 4e 5d EN]