task-title: clean up active window changed
task-title: clean up active window changed

 * Refactor and move duplicate code into
   their own functions
 * Clean up the if-logic
 * More comments

lanoxx/window-picker-applet,lanoxx/window-picker-applet