0

I have a particular need, while I write the notes with Evernote on a firefox window, I need to send back the video lesson on another firefox window.

The video lessons can be either on youtube or on other sites that use Wistia.

I managed, via xdotool and xbindkeys, to send the command but only with an open firefox window, if I have another open firefox window, so with 2 open firefox windows, the command doesn't work.

Basically I have to send the command with xdotool to a firefox window with a certain url in the open tab, for example a tab which is www.youtube.com

#!/bin/bash
xdotool search --class firefox key --window %@ Left

Is it possibile to do that? How can I do that?

EDIT:
I tried two solutions but they don't work 100%, in fact the command is sent to the active firefox window, or the last one activated if I run the script from the console.

Solution 1:

pids=$(xdotool search --class "firefox")
for pid in $pids; do
    name=$(xdotool getwindowname $pid)
    if [[ $name == *"finestradellevideolezioni"* ]]; then
        echo $name
        xdotool key --window $pid Left
    fi
done

Solution 2:

xdotool search --name "finestradellevideolezioni" key Left

I changed the title of the firefox window with the video lessons, uniquely.
Furthermore, when I run the Solution1 script from the console, the output is exact, the title of the exact window is printed, the one with the modified title.

0 Answers0