I have a window whose window ID is 0x0100000b
. If I run
wmctrl -c 0x0100000b
It closes this window as expected. However, if I to
test=0x0100000b
wmctrl -c $test
It doesn't (on both zsh and bash). I don't know why it is happening as I was expecting to achieve the same result. That is just an MWE that sheds light on problem I am facing, which is expanding arguments with the wmctrl
command.
Acutally
wmctrl
is expanding variables properly. I was missing an option from my part. If you want thatwmctrl
interpret window arguments by its window ID rather than its string name, you must pass the-i
flag. From the manual:If you don't put this argument, you will get an unpredictable behavior when passing numeric argument.