Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How may I restore the windows for a given pid? It would be useful in some situations where the window of a certain program disappears (happens to me sometimes).

For example, every time when i'm heading to close hexchat, it shows a dialog for confirmation. If i click cancel, the window is gone anyway, but the process continues running in the background. ( I can pgrep it's id ).

Is it possible to restore the window, given I know the pid?

share|improve this question

closed as unclear what you're asking by Braiam, Eric Carvalho, BuZZ-dEE, i08in, psusi May 8 at 18:06

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Did you figure this out? This still happens occasionally to me - looks like they're having trouble fixing this one. –  uosɐſ Jan 17 at 0:54
    
I don't remember exactly. Had to come back to windows for a while. I think someone told me in the chat that it had been fixed on the development branch at the time. But if you say it still happens, then the bug is still there... Sorry not to be of any help. –  userEng15 Jan 17 at 12:33

5 Answers 5

Unfortunately, no — there is generally no way to get an X Windows application to reconnect to the windowing system if it loses its connection and its window is destroyed. And windows will generally only disappear if there is a bug in the program itself — in which case the process is probably in a hung state without knowing it, waiting on I/O that will never occur because it does not realize its window has gone away.

Unless the application is of a very rare design and lets you send it a special signal or message to reconnect to the X server, or rebuild a new window, or unless it is still present on the screen somewhere as an icon or docked icon and you can interact with it that way, the program's process must simply be killed and you have to restart it.

The behavior of closing its last window without exiting the process is generally a bug that you can report upstream about the application.

(Note: there are rare exceptions, like web browsers that keep a running process even once their last window is closed — but in those cases, re-clicking the browser's icon or re-running it from the command line simply tells the already-running process to open a new window. Again, an app has to be specially written to handle temporary windowlessness if this is to work.)

share|improve this answer

If the process is simply in the background, perhaps this answer fits here too:

Use fg to bring the process back to foreground.

See the full answer for more instructions.

share|improve this answer

I don't know hexchat, but possibly the program uses a tray icon which makes it possible to get the main window back. Unfortunately, there are multiple tray implementation on linux and not all of them work together.

I had such a problem with the program RadioTray which didn't show up anymore after the update to Xubuntu 14.04. The solution was reconfiguring it (the file ~/.local/share/radiotray/config.xml had the option 'gui_engine' with the 3 possible values 'appindicator', 'systray' and 'chooser').

If this doesn't help, try to check the options/preferences of your application. Possibly you find an option 'Minimize to tray'. Disable it and try closing the window again.

share|improve this answer

As Brandon Rhodes explained, if the window is destroyed/hidden by its parent process, no way to recover/recreate/show it from outside the process or application itself.

You can confirm from window manager, try: wmctrl -l -p, no window related to its PID is listed.

So, It possible that hexchat is still responsive, try:

hexchat -e --command="gui show"

-e Open URL or execute command in an existing HexChat

References:

share|improve this answer

You could try Ctrl + Alt + Del, then end the process. Hope this helps. This is what I do when a program in Ubuntu freezes or acts funny to me.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.