In the standard case, the commands currently used are correct pgrep/pkill -x -u "$user" "$PSNAME"
For Firefox, Librewolf (or other?), do not use the command line pattern only: in this case all the processes and sub-processes containing the word 'firefox' in their command line will be taken into account for detection ( running_check ()) and stopped (kill_browsers ()).
Do not rely solely on the process name'GeckoMain' => how to differentiate Firefox and Librewolf for example?
Case scenario: psd configured with BROWSERS=firefox
a) leafpad firefox_text running => psd does not start if you match the command line only.
b) librewolf running => psd does not start believing it is firefox (do not rely solely on the name of the process 'GeckoMain')
c) firefox + librewolf running => 2 GeckoMain processes, but only one should be considered as running because BROWSERS=firefox
d) For 2 simultaneous firefox processes running (possible with 2 different versions of firefox) => take into account the 2 GeckoMain processes
Solution meeting the following constraints:
pgrep/pkill -x -u "$user" "$PSNAME"
running_check ()
) and stopped (kill_browsers ()
).'GeckoMain'
=> how to differentiate Firefox and Librewolf for example?BROWSERS=firefox
a)leafpad firefox_text
running => psd does not start if you match the command line only. b)librewolf
running => psd does not start believing it is firefox (do not rely solely on the name of the process'GeckoMain'
) c)firefox + librewolf
running => 2 GeckoMain processes, but only one should be considered as running becauseBROWSERS=firefox
d) For 2 simultaneous firefox processes running (possible with 2 different versions of firefox) => take into account the 2GeckoMain
processes