When the mood strikes you can be synonymously replaced by the phrase "when you feel like it". This can be used to describe a situation where a person does a certain task or activity when they are in the right mindset or when they are in the mood for it. Some other synonyms for this phrase can be "when you are inclined to", "when the urge comes", "when the feeling hits", or "when the spirit moves". All these phrases convey the message that the person is doing something at a time that feels natural or appropriate to them. Using these synonyms can add variety to communication and help in avoiding repetition of words and phrases.