-   Slackware (
-   -   wmctrl is not showing all windows (

emgee_1 10-20-2012 10:22 AM

wmctrl is not showing all windows
Dear Slackers,

I am using Slackware 14 64 bit and installed using sbopkg wmctrl; I use openbox as window manager and want to control the different started apps using wmctrl;
now having maybe 8 windows open the

wmctrl -l
should give a list of all windows but it doesn't. It appears that this has to do 64 bit version.

I found some code

#ifdef __x86_64
            if(ret_type == 32) tmp_size *=2;

To add ad main.c at line 1441;
I modified manually main.c and executed the slackbuild; but it won't compile.

Background why I want this is this article by urukrama :

The code was taken from here:
x86_64 part 2
Posted 6th Mar 2012 at 16:57 by Rod3775
Tags 64 bit, wmctrl, xwindows
When XWindows was ported to 64 bit architectures, the decision was made (probably for legacy compatibility) not to add a 64 bit data format to routines that return overloaded pointers, specifically XGetWindowProperties. Pointers, which are 64 bits, are returned in 64 bit elements that are claimed to be 32 bits. There is no way to cope with this in user code, except to check which architecture you are running on. The compiler define "__x86_64" is set on Intel 64 bit compilers. wmctrl (not part of base Slackware, but available as a Slackbuild), uses this routine and fails. In wmctrl-1.07/main.c add the following after line 1441 to fix the problem:
#ifdef __x86_64
if(ret_type == 32) tmp_size *=2;

Any pointers are much appreciated


ppencho 10-21-2012 03:36 AM

The compilation error was that ret_type variable was not defined. Also your patch does not make sense because at the next line (1443 in the original main.c) tmp_size is changed again.

So I did some tests and it seems that the correct patch is:

#ifdef __x86_64
    if (ret_format == 32)
        ret_format *= 2;

It works here, but use it w/o any WARRANTY :)

emgee_1 10-21-2012 11:53 AM

the proposed patch works
Thank you ppencho: your patch works;

the proposed small script on urukrama's blog is now working correctly.

for those interested this is the small working script of urukrama:


# Use dmenu to launch or raise and focus running applications

CMD=$(dmenu_path | dmenu -b -fn '-*-nu-*-*-*-*-*-*-*-*-*-*-*-*' )

# if no instance of the app has been started, launch one now
if [ -z "`wmctrl -lx | grep -i $CMD`" ]; then
    $CMD &
    # search for existing app on any desktop and move it to the current desktop
    app_on_any_desk=`wmctrl -lx | grep -i $CMD | cut -d ' ' -f 1`
    wmctrl -i -R $app_on_any_desk
    #wmctrl -i -X $app_on_any_desk

So what does it do:

Sometimes you find yourself in a situation that you fire up some terminals and other apps along the way and all your workspaces get cluttered up. To avoid that this little script brings your needed terminal or app into focus by bringing it to the current desktop. I you bind a key to the script then by typing the intial name of the app for example ter for terminal and it wil bring an existing terminal on some workspace into focus on your current workspace (if you have not terminal running then typing terminal will start a new instance. It keeps your workspace tidy and you do not need to have a lot of terminals open.

Thanks for your solution.
Thank you for your attention


All times are GMT -5. The time now is 03:30 PM.