Reverted the code and added some more lines.
Now both the shift plus click works and minimisation on click if app is
focused and single window