How to refresh a window by terminal? Or how to simulate `F5`?

11,609

Solution 1

With xte tool from xautomation package it is as simple as

xte "key F5"

It will act on the current active window, so you'd have to make sure the proper one is selected previously.

Solution 2

You could also use xdotool, which would allow you to do that on a window which hasn't focus too.

Share:
11,609

Related videos on Youtube

GarouDan
Author by

GarouDan

Updated on September 18, 2022

Comments

  • GarouDan
    GarouDan over 1 year

    I would like a way to refresh a specific window from the terminal command-line.

    Probably I will need a command to find the id or the name of the window and a command to refresh it.

    It looks like xrefresh cannot do this; how could I do this?

    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' over 12 years
      xrefresh refreshes all partly- or fully-visible windows, i.e. all windows for which refreshing may have an effect. If it dosen't work for you, then refreshing is not what you're after. It is pretty rare to need to explicitly refresh a window. What problem are you trying to solve? If the problem is that the text inside the terminal is garbled because some background application has written a message, you can't do anything about it at the X level or on the terminal, you need to tell your application inside the terminal to refresh its display.
    • GarouDan
      GarouDan over 12 years
      @Gilles I'm doing a script to manipulate some specific windows. And I would like refresh these windows automatically. So if I have a comandline way to do this, I can put it in my shell script.
    • rozcietrzewiacz
      rozcietrzewiacz over 12 years
      xte from xautomation package that I proposed to you here, works flawlessly for me.
    • GarouDan
      GarouDan over 12 years
      Yes it works @rozcietrzewiacz. I thought about this, but I didn't find the shortcut, but it was so simple just F5 =). Thx. Please write as answer to me embrace it.