Linux Lib: notify lib (asynchronous notifications)

Anwendungen, Tools, Userlibs und anderes nützliches.
walker
Beiträge: 278
Registriert: 29.08.2004 18:39
Wohnort: Bayern

Linux Lib: notify lib (asynchronous notifications)

Beitrag von walker »

Wolltest Du schon immer asynchrone Nachrichten haben? Hier sind sie:
benötigt die libnotify und devel files...
Ein Screenshot:

Bild

diese Nachricht erscheint in der unteren rechten Ecke sofern keine GadgetID oder WindowID angegeben wurde

oder so, wenn eine GadgetID angegeben wurde:

Bild

Ein Besipel:

Code: Alles auswählen

	#NOTIFY_URGENCY_LOW         = 0;,		 /**< Low urgency.      */
	#NOTIFY_URGENCY_NORMAL   = 1;,	    /**< Normal urgency.   */
	#NOTIFY_URGENCY_CRITICAL   = 2;,       /**< Critical urgency. */

Procedure mycallback()
; if the notification is clicked somwhere, this code will be executed...
EndProcedure

pgm.s=ProgramFilename()
notify_init_(@pgm); necessary to init the notification server for your program
hwnd=OpenWindow(0,200,100,500,350,"")
CreateGadgetList(WindowID(0))
    ButtonGadget(1,10,10,100,30,"Test")
    mn=notify_show("titel","body",50,#NOTIFY_URGENCY_NORMAL,GadgetID(1)); the notification is added to a gadget
;     mn=notify_show("titel","body",50,2,0); use this line to see the difference
;if you need an action when the notification is clicked
    action.s="default"
    label.s="clicked"
    notify_add_action(mn,@action,@label,@mycallback(),0,0)
;---------------------
CloseGadgetList()
Repeat
    ev=WaitWindowEvent(1)
ForEver
End
und nun hier die Lib::
http://home.arcor.de/x-linux/pure/notify/notify_lib (am besten nach purebasic/purelibraries/userlibraries kopieren

der Sourcecode:
http://home.arcor.de/x-linux/pure/notify/notify_lib.pb

ein weiterer Befehl der Lib ist notify_close(*notify) welcher in dem Beispiel nicht verwendet wird

Ich denke, anhand des Beispieles ist zu ersehen, wie die lib funktioniert. Wenn nicht.. einfach fragen.

Kritik, Anregungen etc sind jederzeit willkommen
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

Code: Alles auswählen

notify_init_(@pgm); necessary to init the notification server for your program 
Macht nen Speicherzugriffsfehler :(
Hab alle notwendigen libs (auch devel) installiert

Gruß
Thomas
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
walker
Beiträge: 278
Registriert: 29.08.2004 18:39
Wohnort: Bayern

Beitrag von walker »

HA... ich wusste das ich was übersehen habe.... wird repariert :wink:

[EDIT]
....sollte jetzt repariert sein... hatte einen Pfad fest eingegeben... klar das das auf einer anderen Distro ggf. zu Problemen fuhrt :freak: Habe die neuen Dateien hochgeladen (siehe 1. Post)
[/EDIT]
Benutzeravatar
MVXA
Beiträge: 3823
Registriert: 11.09.2004 00:45
Wohnort: Bremen, Deutschland
Kontaktdaten:

Beitrag von MVXA »

Habe die LibNotify leider nicht :(. Würde es sonst gerne testen.
Bild
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

walker hat geschrieben:HA... ich wusste das ich was übersehen habe.... wird repariert :wink:
Keine Änderung :(
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
vonTurnundTaxis
Beiträge: 2130
Registriert: 06.10.2004 20:38
Wohnort: Bayreuth
Kontaktdaten:

Beitrag von vonTurnundTaxis »

Ich habe den gleichen Fehler.
Nicht durch Zorn, sondern durch Lachen tötet man
ClipGrab | Pastor - jetzt mit kurzen URLs!
walker
Beiträge: 278
Registriert: 29.08.2004 18:39
Wohnort: Bayern

Beitrag von walker »

könntet Ihr beide mal bitte diesen code ausführen

Code: Alles auswählen

mypgm= RunProgram("whereis", "libnotify.so","",#PB_Program_Open|#PB_Program_Read )
While ProgramRunning(mypgm)
      output$ + ReadProgramString(mypgm) 
Wend
notifylibrary$=""
a=CountString(output$," ")
For m=2 To a+1
    tmp$= StringField(Output$,m," ")
    If GetExtensionPart(tmp$)="so"
        notifylibrary$= tmp$
    EndIf
Next 
CloseProgram(mypgm)
Debug notifylibrary$
und mir den Debug output mitteilen? (ich vermute mal ihr habt beide SusE?)

@MVXA: diese kannst Du doch über den Paketmanager Deiner Distro nachinstallieren... (nach libnotify suchen wenn's eine GUI gibt oder apt-get install libnotify-bin bzw libnotify-dev verwenden, wenn Du ne Debian Distro hast)
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

>> und mir den Debug output mitteilen? (ich vermute mal ihr habt beide SusE?)
openSuSE 10.1 :wink:
Der DebugOutput ist ziemlich leer :(
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
walker
Beiträge: 278
Registriert: 29.08.2004 18:39
Wohnort: Bayern

Beitrag von walker »

.... und was ergibt

Code: Alles auswählen

whereis libnotify
eingegeben in einer konsole?
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

walker hat geschrieben:.... und was ergibt

Code: Alles auswählen

whereis libnotify
eingegeben in einer konsole?
thomas@dhcppc0:~> whereis libnotify
libnotify:
thomas@dhcppc0:~>
// EDIT

Code: Alles auswählen

Procedure init_notify()
  notifylibrary$ = "/opt/gnome/lib/libnotify.so"
so gehts :wink:
Zuletzt geändert von ts-soft am 28.10.2006 19:58, insgesamt 1-mal geändert.
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Antworten