Action to change magnifying glass function


Is it possible to alter the behavior of the search magnifying glass at the top right? I would like to have it open a scanning dialog where the user would scan a barcode and the program would display a detail view based on the result of the scan.

If this is not possible, could it be done with menu view and, if so, how would this be accomplished?

Thank you in advance