开发者

Opening an existing process

开发者 https://www.devze.com 2022-12-21 19:05 出处:网络
I am using Eclipse in Linux through a remote connection (xrdp).My internet got disconnected, so I got disconnected from the server while eclipse was running.

I am using Eclipse in Linux through a remote connection (xrdp). My internet got disconnected, so I got disconnected from the server while eclipse was running.

Now I logged in again, and I do the "top" command I can see that eclipse is running and still under my user name.

Is there some way I can bring that process back into my view (I do not want to kill it because I am in the middle of checking in a large swath of code)? It doesnt show up on the bottom panel after I logged in again.

Here is the "top" output:

/home/mclouti% top
top - 08:32:31 up 43 days, 13:06, 29 users,  load average: 0.56, 0.79, 0.82
Tasks: 447 total,   1 running, 446 sleeping,   0 stopped,   0 zombie
Cpu(s):  6.0%us,  0.7%sy,  0.0%ni, 92.1%id,  1.1%wa,  0.1%hi,  0.1%si,  0.0%st
Mem:   3107364k total,  2975852k used,   131512k free,    35756k buffers
Swap:  2031608k total,    59860k used,  1971748k free,   817816k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
13415 mclouti   15   0  964m 333m  31m S 21.2 11.0  83:12.96 eclipse
16040 mclouti   15   0  2608 1348  888 R  0.7  0.0   0:00.12 top
31395 mclouti   15   0 29072  20m 8524 S  0.7  0.7 611:08.08 Xvnc
 2583 root      20   0  898m 2652 1056 S  0.3  0.1 139:26.82 automount
28990 postgres  15   0 13564  868  304 S  0.3  0.0  26:33.36 postgres
28995 postgres  16   0 13808 1248  300 S  0.3  0.0   6:54.95 postgres
31440 mclouti   15   0  3072 1592 1036 S  0.3  0.1   6:01.5开发者_高级运维4 gam_server
    1 root      15   0  2072  524  496 S  0.0  0.0   0:03.00 init
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:04.53 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/0
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    5 root      RT  -5     0    0    0 S  0.0  0.0   0:01.72 migration/1
    6 root      34  19     0    0    0 S  0.0  0.0   0:00.07 ksoftirqd/1
    7 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/1
    8 root      RT  -5     0    0    0 S  0.0  0.0   0:04.33 migration/2
    9 root      34  19     0    0    0 S  0.0  0.0   0:00.05 ksoftirqd/2


It is a long shot, but you could try this little program from this thread

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>

int main(int argc, char **argv)
{
if ( argc != 2 ) {
printf("Usage:\n\ttotop <window id>\n");
return 1;
}

Display *dsp = XOpenDisplay(NULL);

long id = strtol(argv[1], NULL, 16);
XRaiseWindow ( dsp, id );
XSetInputFocus ( dsp, id, RevertToNone, CurrentTime );

XCloseDisplay ( dsp );

return 0;
}

You can compile it with:

$ c++ totop.cpp -L/usr/X11R6/lib -lX11 -o totop

I assumed that you saved it in "totop.cpp".

It has problem I do not know how to fix:
if window is in another virtual desktop this program doesn't work.
Here another question rises: how to send window to current desktop?

You can get window id using xwininfo.
A little script using this program used to call Eclipse:

#!/bin/bash
if ps -A | grep eclipse; then # if Eclipse already launched
  id=$(xwininfo -name "Eclipse" | grep id: | awk "{ print \$4 }")
  totop $id
else # launch Eclipse
  eclipse
fi
0

精彩评论

暂无评论...
验证码 换一张
取 消