improve notification and dock icon badge logic