How to identify halal business activity?

A lot of times there are confusion regarding certain activity being halal or haram like for example there are some queries asking if supplying food or stationery or medical service to a banker or a person involved in non-compliant activities will also be considered haram.
While most of these queries are genuine from discerning muslims, some are even to mock. But to the discerning , lets try and understand because people who don't want to understand or find faults will always have a fallacy to point out.
We all know that activities such as conventional banks, music, alcohol etc. are not compliant and there is no doubt about these. So if a company is directly involved in any of these it is non-complaint.
But how to deal with when there is indirect linkage.
There are two scenarios for indirect linkage.
Scenario 1. The company produces specific goods/services that further the cause of the haram activity.
For example a company that produces brewery machinery along with other kinds of machinery will not be considered halal. One such example in NSE will be Praj Industries , while it produces other kinds of machinery it also produces equipment for distilleries.
or TCS and some other IT companies which produce software specifically for banks and insurance companies. These software are not general purpose software like Windows or MS Office but are specific to banks/FI only.
The above is a conservative view that we would like to follow, of course there are scholars with a more lenient view on these matters.
Scenario 2. The company produces good/services which are halal in nature and can be used by all.
For example : A company that produces furniture, stationery, biscuits , juice etc., that can be used by all, even if these are bought by banks or other such non -complaint business , the same inshallah will not be considered haram.
So Hindustan Unilever produces goods which can be used by all and the goods that it produces are halal. So even if a banker, or alcohol manufacturer buys from them it will not be considered haram since it is not furthering the haram cause or the goods are not specifically produced for that purpose.
Similarly, if a company manufactures personal computers which is a general purpose machine, now this PC can be used by banks , bars , education institutions, etc. So here the product itself is halal but its usage by the buying party is halal or haram and the seller has no direct control over that and it is upto the user to use it the way they deem fit. So in such cases the company's activity shall not be considered non-compliant.
Even amongst these sometimes there can be scenarios wherein there is ambiguity and it may be difficult to clearly identify. Our analyses and assessment should be based on things that are practically measurable and verifiable. In such cases we would like to take the practical yet conservative approach. Since our intention is not just to invest and earn in any way, but to try and follow and be as close to the sharia principles as much as possible.
لَهُۥ مَقَالِيدُ ٱلسَّمَٰوَٰتِ وَٱلۡأَرۡضِۖ يَبۡسُطُ ٱلرِّزۡقَ لِمَن يَشَآءُ وَيَقۡدِرُۚ إِنَّهُۥ بِكُلِّ شَيۡءٍ عَلِيمٞ
To Him belong the keys ˹of the treasuries˺ of the heavens and the earth. He gives abundant or limited provisions to whoever He wills. Indeed, He has ˹perfect˺ knowledge of all things.
(Surah Ash Shura 12)
May Allah guide us to the right path and help us choose the halal and provide us beneficial sustenance and forgive our shortcomings.
Ameen.