Define a custom shortcut for Compiz Window Manager

Karl Auer kauer at biplane.com.au
Thu Apr 21 23:53:55 UTC 2016


On Fri, 2016-04-22 at 03:15 +0530, Shashwat Kumar wrote:
> I use compiz windows manage with Ubuntu 14.04. I want to define a 
> custom shortcut which acts on current focused window. For example, I 
> want to define a shortcut say Ctrl+Super+R which snaps the window to 
> 75% of its width. So I need to define some code also to define the 
> action. Is there some feature to define custom shortcut and API to
> define the action.

I don't know how to achieve the specific resize action you mention, but
I do know how to bind an arbitrary command to an arbitrary key combo.

In the manager, see the "Commands" module on the "General" tab. This
lets you bind an arbitrary command to an arbitrary key combo. You
define the command on one tab, e.g. command0, then bind it to a key
combo on the "Key bindings" tab. There is an example there (at least
there is in 15.10) that binds gnome-system-monitor-p to ctl-alt-del.

You can also bind commands to mouse button presses or hitting the edges
or corners of windows. This doesn't see to be how hot corners are
achieved in Unity though, as I have two hot corners but they are nt
visible in this module.

So if you can figure out a command to execute that will resize a
window, you should be able to bind it to a keystroke.

It's not exactly what you are looking for, but you can also define
rules for window management in the "Window Management" -> "Window
Rules" module. Provided you can identify a window by ID, title or
whatever, you can define rules about how it will be managed. i think
they are declarative though, not dynamic. You might be able to trick it
by (for example) having a command that changed the window title, plus a
rule for that title, but I'm really only guessing. And the rules may
apply only on window creation.

I have NOT used it myself, but the command wmctrl looks very
interesting in this context. Google "ubuntu command line resize window"
and look at a few of the links e.g. some of the answers in this thread:

   http://ubuntuforums.org/showthread.php?t=1526631

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: E00D 64ED 9C6A 8605 21E0 0ED0 EE64 2BEE CBCB C38B
Old fingerprint: 3C41 82BE A9E7 99A1 B931 5AE7 7638 0147 2C3C 2AC4







More information about the ubuntu-users mailing list