Open piotrekkr opened 9 years ago
xwininfo is giving you wids in hex format. xdotool uses decimal format. You can use printf's built in conversion to deal with this.
printf '%d\n' $xwinfo_id
I noticed that the conversion to decimal is redundant (see a tutorial of mine (in progress))
Here is my bash function how to extract a window ID from wmctrl
:
#!/bin/bash
# Get the ID of the *first* window with the arguments
# as its window title
function get_dialog_id
{
echo `wmctrl -l | egrep "$*" | head -n 1 | cut -f 1 -d ' '`
}
I can then feed it to xdotool
like:
id=`get_dialog_id "$@"`
xdotool windowactivate $id sleep 0.1 key alt+F4
I'm trying to send
ctrl+q
keystroke to thunderbird which is hidden inside systray.xdotool
is not seeing thunderbird when it is inside systray (window state withdrawn) so this does not return window ID:It only works when there is a taskbar entry for thunderbird.
I also tried searching by PID:
But this does not work:
I'm wondering if there is some kind of option to give
xdotool
the window ID acquired usingxwininfo
? Something like:or
Thanks