Define a custom shortcut for Compiz Window Manager

Ralf Mardorf silver.bullet at zoho.com
Fri Apr 22 08:34:09 UTC 2016


On Fri, 22 Apr 2016 17:45:02 +1000, Karl Auer wrote:
>On Fri, 2016-04-22 at 08:55 +0200, Ralf Mardorf wrote:
>> On Fri, 22 Apr 2016 12:57:09 +1000, Karl Auer wrote:  
>> > wmctrl -i -r <ID> -e -1,-1,-1,w,h  
>>                       ^^ this must be 0.  
>
>According to the man page, values passed as -1 are left as is. Reading
>it carefully, that may only apply to the window dimensions, not to the
>gravity. 0 is the default; that may not be the current value. I'm
>pretty sure it can be values other than zero, but I bow to anyone who
>actually knows :-)

I get this output when using "-1":

$ wmctrl -i -r $(wmctrl -l | grep "Claws Mail 3.13.2" | cut -d" " -f1) -e -1,-1,-1,200,200
Value of gravity mustn't be negative. Use zero to use the default gravity of the window.

>> The good news, this works. The bad news, it works only if the Windows
>> isn't maximised. How can a window be "un"maximised?  
>
>Dunno. It may also be related to your specific window manager - window
>managers are free to ignore stuff they don't like. Maybe use xdotool
>instead?

This issue is solved by
$ wmctrl -i -r $(wmctrl -l | grep "Claws Mail 3.13.2" | cut -d" " -f1) -b remove,maximized_vert,maximized_horz
$ wmctrl -i -r $(wmctrl -l | grep "Claws Mail 3.13.2" | cut -d" " -f1) -e 0,-1,-1,200,200

>What do you get with "xdotool getactivewindow"? I always get a window
>ID (in decimal) that I can plug straight into wmctrl.

Now it works :).

$ wmctrl -l
0x00600003 -1 archlinux panel
0x00c0001d -1 archlinux panel
0x01000003  0 archlinux Rocketmouse - Claws Mail 3.13.2
0x01400012  0 archlinux Inbox (49315 unread) - Evolution
0x01a00003  0 archlinux Unknown Crewman - Sylpheed 3.5.0
0x01c00007  0 archlinux rocketmouse at archlinux:~
0x0111073e  0 archlinux Re: Define a custom shortcut for Compiz Window Manager - Compose message [Edited]
$ xdotool getactivewindow
29360135
$ printf '%x\n' $(xdotool getactivewindow)
1c00007

When I tested it the first time I used "getwindowgeometry" instead of
"getactivewindow".

    $ xdotool getwindowgeometry
    There are no windows in the stack
    Invalid window '%1'
    Usage: getwindowgeometry [window=%1]
    If no window is given, %1 is used. See WINDOW STACK in xdotool(1)

So the OP needs the math to calculate the window size and then run

either

window="0x$(printf '%x\n' $(xdotool getactivewindow))"

or, since there's no need to use hex

window="$(xdotool getactivewindow)"

and then

wmctrl -i -r $window -b remove,maximized_vert,maximized_horz
wmctrl -i -r $window -e 0,-1,-1,$w,$h

where $w,$h are the variables for the size.

Solved ;).

Regards,
Ralf





More information about the ubuntu-users mailing list