Project

General

Profile

unexist.dev

/

subtle

Assorted tidbits and projects

Hooks » History » Version 10

« Previous - Version 10/47 (diff) - Next » - Current version
Anonymous, 12/06/2009 03:07 PM


Hooks\015\012\015\012Hooks are small chunks of code (procs) that can be called on certain events of the window manager.\015\012\015\012Here is a list of the existing types of hooks:\015\012 \015\012{{>toc}}\015\012\015\012h2. Create client\015\012\015\012Triggers on creation of new clients.\015\012
\015\012:HookClientCreate => lambda { |c| puts c.name }\015\012
\015\012\015\012h2. Client configure\015\012\015\012Triggers whenever a client is configured.\015\012
\015\012:HookClientFocus => lambda { |c| puts c.name }\015\012
\015\012\015\012h2. Client focus\015\012\015\012Triggers whenever a client gets focus.\015\012
\015\012:HookClientFocus => lambda { |c| puts c.name }\015\012
\015\012\015\012h2. Client kill\015\012\015\012Triggers when a client is killed.\015\012
\015\012:HookClientKill => lambda { |c| puts c.name }\015\012
\015\012\015\012h2. View client\015\012\015\012Triggers on creation of new views.\015\012
\015\012:HookViewCreate => lambda { |v| puts v.name }\015\012
\015\012\015\012h2. View configure\015\012\015\012Triggers whenever a view is configured.\015\012
\015\012:HookViewFocus => lambda { |v| puts v.name }\015\012
\015\012\015\012h2. View jump\015\012\015\012Triggers on a jump to a view.\015\012
\015\012:HookViewJump => lambda { |v| puts v.name }\015\012
\015\012\015\012h2. View kill\015\012\015\012Triggers when a view is killed.\015\012
\015\012:HookViewKill => lambda { |v| puts v.name }\015\012
\015\012\015\012h2. Examples\015\012\015\012Switch to the first view of new client\015\012
\015\012:HookCreate => lambda { |c| c.views.first.jump }\015\012
\015\012\015\012Tag a new client with the current view\015\012
\015\012:HookClientCreate = lamda { |c| c.tag(current_view.name) }\015\012
\015\012\015\012Tag a new client with the current view only if it has no other tags\015\012
\015\012:HookClientCreate => lambda { |c| \015\012  if(c.tags.empty?)\015\012    if(!tags.include?(current_view.name))\015\012      add_tag(current_view.name)\015\012    end \015\012    c.tag(current_view.name);\015\012  end\015\012}\015\012
\015\012\015\012Display information about the currently focused window\015\012
\015\012:HookClientFocus => { |c| find_sublet("client").data = "%s (%s)" % [ c.name, c.class ] }\015\012
\015\012\015\012