Yes, this is possible- I have been experimenting with
xbindkeys, and they are mostly all you need to pull it off, so please enter
sudo apt-get install xdotool xbindkeys x11-utils xinput
Now, your middle mouse button is usually button 2, but you can check by using
xev and clicking in the event tester box, or looking at the output of
xinput and that will list your devices, so note the id for your mouse and then enter
xinput list-props < device id >
to find details on your mouse buttons. You can always choose a different mouse button if your middle button doesn't register properly or is unavailable.
xdotool command you need for what you want to do is:
xdotool getactivewindow windowminimize
This command minimises the active window; however this action must also be associated with mouse button 2 and the way to do that is to use
xbindkeys. We place the above command in
~/.xbindkeysrc (see below) and associate it with the middle mouse button (
b:2), so that the depressing of mouse button 2 triggers the
xdotool command will work in the terminal if executed and will minimize it, so showing that it is the necessary command for what you want.)
This entry must be placed in your
"xdotool getactivewindow windowminimize"
xdotool command must also be enclosed in quotes (as above) when placed in that file.
xbindkeys re-reads the file, you can clear current bindings with
killall xbindkeys and then just execute
xbindkeys to restart it.
Now your command will be available;
xbindkeys doesn't seem to need to be put in startup for me, and you can run your command without rebooting; you can cancel it any time again by entering
killall xbindkeys and then editing your