If I understand correctly, you are using MacPorts and Geany is started as a command-line app when using it without being properly packaged to an app bundle which results in the various problems you describe.
Geany, however, provides both x86 and arm64 app bundles here https://geany.org/download/releases/ which are properly signed and notarized with Apple and these issues shouldn't be present there.