Fundamental gaps of finite systems from the eigenvalues of a generalized Kohn-Sham method