I had a habit of complaining mostly to small stuff, though I seem to accept big issues better.
One of the strategies I adopted to give up this habit was to maintain a complain dairy - every time I complained, I would simply log into the diary. At the end of each day, I will spend 5 mins to look at everything I complained about.
This 5 min exercise helps me in finding patterns about things that irritates me, tell myself regularly that these are simple things that don't deserve my mental space and lastly acknowledge I am a human being after all.
I have reduced the no of my complaints dramatically. Now, I stop before complaining.
Happy to try the new trick you have suggested as well Darius.