answersLogoWhite

0


Best Answer

I could not find the answer to this anywhere else, so I came up with the following program.

Note, Answers may reformat the code, so don't blame me for bad formatting! Also, if the output format of xwininfo changes, the program won't work. In this case, you may need to change the number of times that fgets() is called, or change the scanf format.

Also, I have copyrighted this program both to retain credit, and to make sure nobody else copyrights it to keep it from being freely available. You may do anything you like with the program except change or remove the copyright notice or distribute a compiled binary without this source and any changes you have made to it.

/* Copyright (C) 2012 Michael A. Bloom ({my first two initials followed by my last name}@{combine two words as follows: "dsl" followed by the word: extreme} dot com})

You may not change or remove this copyright notice, but except for distributing binaries without this original source and any changes you have made to it, you may otherwise do anything you wish with this code.

*/

#include

#include // Every Xlib program must include this

/* Chrome leaves unwanted windows around that are left over from popups. */

/* They are not present in the list produced by wmctrl -l. If your */

/* window manager is either metacity or openbox, it is a curious thing */

/* that although restarting either of them does not change anything, */

/* running metacity --replace (if not already running metacity) followed */

/* by openbox --replace, followed by metacity --replace (with three */

/* second sleeps between invocations) gets rid of the unwanted windows. */

/* As it is time consuming to do all that, I came up with this kludge to */

/* get rid of the obscuring windows more quickly. */

/* This is not a great workaround, as after getting rid of these orphan */

/* windows, new ones will continue to appear (once they have started to */

/* do so, they will keep on doing so). But it's better than nothing. */

void exit(int);

char linebuf[BUFSIZ];

main( int argc, char **argv){ FILE *fp;

int i;

Display *dpy = XOpenDisplay(NULL);

int Wid ;

int ret;

printf("Click on UNdesired window\n");

fp = popen("xwininfo","r");

/* Warning: This kludge will break if xwininfo's output format changes */

for (i=0;i< 5;i++){fgets(linebuf,sizeof(linebuf)-1,fp);}

fscanf(fp, "xwininfo: Window id: %i",&Wid);

pclose(fp);

/* Should this be XDestroySubwindows() ? */

ret = XDestroyWindow(dpy,(Window)Wid);

/* printf("%d\n",ret); */

XCloseDisplay(dpy);

exit(0);

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In linux How can one remove an Xorg window that the window manager is unaware of?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a package manager in Linux?

A package manager is a utility to install remove, upgrade, and track the dependencies of software in Linux.


Does Linux have a 3d window manager?

Yes. Compiz Fusion allows for 3D window management.


What does the yum command do in Linux?

yum is a package manager in several Linux distributions, such as Yellow Dog Linux, Fedora, and Red Hat. It has more than one function,but is primarily used to install and remove packages, and control downloading them from a repository.


What is 'Compiz' and how do you turn it off?

If you're referring to the Compiz window manager which provides OpenGL 'window dressing" enhancements to the Linux GUI desktop, you should be able to just uninstall it and use some other window manager such as Metacity or Sawfish, etc.


What are the various window managers provided by Linux?

A lot! At the time of this writing, there are at least 76 window managers made for X11, which is the video display server used in Linux today. In case you did not know, a "window manager" controls the placement, sizing and interaction of application windows. Typically, a window manager is what we see as the close, maximize and minimize buttons above each program. There's the typical window managers that "stack" the windows on top of each other, including the window manager in Gnome, KDE, MeeGo, etc., as well as the independent (not part of a desktop) Fluxbox, Blackbox, IceWM, Openbox, FVWM, etc... Then there are "tiling" window managers such as Ion, awesome, Ratpoison, etc. KDE's window manager supports tiling. Some window managers are minimal, some purely experimental, some robust, some pretty.


What is file manager in Linux?

There is no set file manager in linux. Examples of Linux file managers include but: Nautilus (GNOME) Thunar (XFCE) Dolphin (KDE)


What is the function of the device manager udev?

The device manager UDEV manages device nodes in /dev in Linux. It is a generic kernal device manager originally was introduced in Linux 2.5, and is still in the current version of Linux.


What is the major achievement of Linux?

Package Manager is The Biggest Achievement of Linux


Which Linux GUI is popular?

i assume by gui, i assume you mean the window manager. gnome and kde are popular. i personally like to use xfce, the "cholesterol free desktop environment".


How do you share files between Linux and Windows?

You can type in smb//192.168.1.1/ into a file manager window (put the windows computers IP address in there though)


What is an alternative to a window?

yes there is mac and there is Linux


What is LVM in Linux?

LVM is a logical volume manager for the Linux kernel; it manages disk drives and similar mass-storage devices.