Automatic web-page refresh using xdotool - not sending key after window focus

CODe picture CODe · Aug 19, 2012 · Viewed 18.7k times · Source

Given:

I have Firefox with the [Firefox Page Title] page open on my Ubuntu computer.

Here is my command:

xdotool search "[Firefox Page Title]" windowactivate --sync key --clearmodifiers ctrl+r

Documentation:

xdotool website with documentation/examples is here.

Example straight from the xdotool website:

# As of version 2.20100623, you can do this simpler version of above:
xdotool search "Mozilla Firefox" windowactivate --sync key --clearmodifiers ctrl+l

Notes:

I'm using xdotool version 2.20110530.1.

The command correctly focuses my screen to whatever window title I choose, but it doesn't send the ctrl+r key to the window, as the website doesn't refresh. I receive no error messages from the command. (Refresh shortcut in Firefox is ctrl+r)

Wanted Behavior:

The command will hopefully (when it works) be applied to a web server statistics page that is open 24/7 on my server computer, I'd like it to refresh the page automatically so I can view new traffic to my website without me having to do anything.

EDIT: I'm open to using other applications that can provide this functionality, if you know of something else that's easy/similar, please provide it as an answer! If I can't get this working I'll default to the next best thing.

Answer

JohnTESlade picture JohnTESlade · Mar 23, 2013

I was trying to send keystrokes to an application and I also concluded that xdotool just doesn't work as described. I ended up using xvkbd to do the same thing.

For your example the following command refreshes a page in Firefox:

xvkbd -window Firefox -text "\Cr"