Use appnope in qt and wx gui support from the terminal

Apply #6321 to master

I merged #6321 before realizing that it was made against the wrong branch, so this doesn't need a backport.