How to check if the current process is active or running in the background?
What function to use?
I meant a function directly from one of the system libraries because I am using Pascal language.
BApplication is in the system library. In Haiku the system library is largely written in C++ and you can’t really avoid that.
There was an ObectPascal wrapper for the BeAPI at one point. You seem to still be able to grab a version of the code from here: The Free Pascal for BeOS initiative - Browse /bepascal at SourceForge.net - I don’t know how much it will help the OP as it was specifically the BeAPI from R5.03, so it won’t be 100% the same.
Edit: It does look like the code has the BApplication wrapped, and there are pascal implementations for:
function GeAppInfo(var info : AppInfo ): Status_t;
// Hook functions
procedure AppActivated(Active : boolean); virtual;
procedure ReadyToRun; virtual;
Unfortunately, Haiku does not have global hook variables.
BApplication must be run to check if it is running in the background.
So I don’t think it can be done.
You can run a BApplication without any UI. If you are writing apps with Pascal, you probably still need to interact with the BeAPI, and if there is a GUI, there will be a BApplication somewhere.
Process can’t be active (in GUI sence) if it don’t create BApplication.
Here Necromancer’s Dos Navigator for Haiku (NDN - best file manager).
You can download it from:
https://megawrzuta.pl/download/55a6a13088b0d42bb4f23aaa5100f68d.html
Not everything is working yet.
For example, the keyboard works while NDN is running in the background.
I don’t know how to fix it.
Please test it.
WOAH! Lemme see!!!
FYI: you can place the .so lib in a lib subfolder, then it doesn’t needs to be copied into the non-packaged tree.
NICE!
It seems input gets frozen sometimes.
You can disable the extended keyboard in menu
Options->Configuration->Advanced Options->Disable the extended keyboard function
but then 70% of hotkeys do not work.