I don’t think it’s a mortal sin if you don’t say it. I suppose you could divide thought into two categories. Voluntary and involuntary. We can indeed be held accountable for our voluntary thoughts. However, the involuntary thoughts are excusable.
The involuntary thoughts are fleeting and brief. They’re reactive to certain stimuli. Something happens and this is just what pops into your head. Not to worry.
The voluntary thoughts are the longer thoughts. They are responsive to stimuli.
For instance: The stimuli may be a provocatively dress woman. The involuntary thought hits your brain, “Looky there! Wowza!” And that’s about how brief I mean. Because from there your voluntary thought kicks in. You now have two choices. Continue gawking, and imagining things. Or master your thought and put it back to where it belongs.
Now, as for actually UTTERING the Lords name in vain, this is how I handle it. If it’s habitual, as in each individual event is not truly fully consented, then those particular events are not mortal sins in and of themselves. That doesn’t mean I can just waltz up the communion isle just yet!
The real way to determine if a habit of profaning God’s name is a mortal sin is I ask myself, “OK, I now know I have a habit of grave matter, what am I doing to stop the habit?” If my answer is, “nothing” then I ought to sit out the communion. If I have a clear answer to the question then I feel pretty good about receiving communion.