From f4cb92e0925d89f346e5abd47af68decf1c9f302 Mon Sep 17 00:00:00 2001 From: Ronny Otto Date: Fri, 28 Jul 2017 10:48:26 +0200 Subject: [PATCH] [Linux] added basic support for "notify" command --- system.mod/system.linux.bmx | 6 ++++-- system.mod/system.linux.c | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/system.mod/system.linux.bmx b/system.mod/system.linux.bmx index eb76c16..3856b09 100644 --- a/system.mod/system.linux.bmx +++ b/system.mod/system.linux.bmx @@ -1,4 +1,3 @@ - Strict Import "driver.bmx" @@ -19,6 +18,8 @@ Function bbMoveMouse(x,y) Function bbSystemDisplay() Function bbSystemEventHandler( callback(xevent:Byte Ptr) ) +Function bbSystemNotify( text$,serious ) + Function bbSystemPostSyncOp( syncOp( syncInfo:Object,asyncRet ),syncInfo:Object,asyncRet ) Function bbSystemStartAsyncOp( asyncOp( asyncInfo ),asyncInfo,syncOp( syncInfo:Object,asyncRet ),syncInfo:Object ) @@ -61,7 +62,8 @@ Type TLinuxSystemDriver Extends TSystemDriver End Method Method Notify( text$,serious ) - WriteStdout text+"~r~n" + system_ "xmessage -center ~q"+text+"~q" +' WriteStdout text+"~r~n" End Method Method Confirm( text$,serious ) diff --git a/system.mod/system.linux.c b/system.mod/system.linux.c index fa5f8a7..9e190e7 100644 --- a/system.mod/system.linux.c +++ b/system.mod/system.linux.c @@ -415,3 +415,14 @@ int bbSystemDesktopHertz(){ XFree( xmodes ); return sz; } + + +void bbSystemNotify( BBString *text,int serious ){ + char cmd[1024]; + sprintf(cmd, "xmessage -center \"%s\"", text); + if(fork()==0){ + close(1); close(2); + system(cmd); + exit(0); + } +}