There is no way for a plugin to accurately determine the current source. If the current source is All Photographs, Quick Collection, or Previous Import, the method catalog:getActiveSources() returns the empty table {}, but it should return catalog.kAllPhotos, .kQuickCollectionIdentifier, or .kPreviousImport.