Metal ion modulation triggers dielectric double switching and green fluorescence in A2MX4-type compounds.