Possibly...it could be your use of double quotes instead of single quotes, using the = instead of -eq, etc.
Sorry, I forgot to look yesterday. Not sure you need the "" around the "$(wmctrl...". I think the case problem and the = sign did the trick...you might, though. What we really should do is grep -i gnumeric which makes the grep case-insensitive, in case they change it. Then I think you're good. Let me know if you do need the "" around "$(wmctrl..." and let me know if you need double instead of single quotes and all that. I guess my bash is rusty.