Score:0

How to send a command to a firefox window with a specific url? (xdotool)

de flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.