Skip to content

Commit

Permalink
display/status/arrange: persistent view arrangements
Browse files Browse the repository at this point in the history
You need to apply the following patch to wmii-hg r2785:

diff -r 327e87c7bb2b cmd/wmii/client.c
--- a/cmd/wmii/client.c	Thu Oct 28 09:55:54 2010 -0400
+++ b/cmd/wmii/client.c	Sun Mar 27 00:48:51 2011 -0700
@@ -492,14 +492,17 @@
 client_map(Client *c) {
 	if(!c->w.mapped) {
 		mapwin(&c->w);
+		event("MapClient %#C\n", c);
 		client_setstate(c, NormalState);
 	}
 }

 void
 client_unmap(Client *c, int state) {
-	if(c->w.mapped)
+	if(c->w.mapped) {
 		unmapwin(&c->w);
+		event("UnmapClient %#C\n", c);
+        }
 	client_setstate(c, state);
 }
  • Loading branch information
sunaku committed Mar 27, 2011
1 parent 89d138f commit 6b9ef9c
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions display/status/arrange.yaml
@@ -0,0 +1,88 @@
display:
status:
arrange:
refresh: # this status bar applet will refresh itself as necessary

@choices:
LarsWM: [arrange_as_larswm]
stacks: [arrange_in_stacks, 2]
grid: [arrange_in_grid]
diamond: [arrange_in_diamond]

script: |
# create actions for each possible choice so that the user can set
# up keybindings to trigger the application of particular choices
@choices.each_key do |choice|
action "apply_#{choice}_persistent_arrangement" do
self.current = choice
end
end
# we can only safely reapply the arrangement once the view has
# stabilized (i.e. we are NOT in the middle of changing views)
@can_reapply = false
event 'ClientFocus' do
@can_reapply = true
end
event 'FocusTag' do |tag|
@current_tag = tag
@can_reapply = false
refresh
end
# persist the arrangement whenever clients are
# added to or removed from the current view
%w[MapClient UnmapClient].each do |trigger|
event(trigger) { apply }
end
def apply
if @can_reapply and @choices.key? current
curr_view.send(*@choices[current])
end
end
@choice_by_tag = {}
def current
@choice_by_tag[@current_tag]
end
def current= choice
raise ArgumentError unless @choices.key? choice
@choice_by_tag[@current_tag] = choice
refresh
apply
end
def stop
@choice_by_tag.delete @current_tag
refresh
end
def choose
if choice = click_menu(@choices.keys, current)
self.current = choice
end
end
label: |
["\u25F1", current || 'manual']
control:
action:
stop_persistent_arrangement: self.stop
choose_persistent_arrangement: self.choose

mouse_action:
left_click: choose_persistent_arrangement
right_click: stop_persistent_arrangement

keyboard_action:
${arrange},Shift-t: apply_LarsWM_persistent_arrangement
${arrange},Shift-g: apply_grid_persistent_arrangement
${arrange},Shift-s: apply_stacks_persistent_arrangement
${arrange},Shift-d: apply_diamond_persistent_arrangement
${arrange},Shift-z: stop_persistent_arrangement

0 comments on commit 6b9ef9c

Please sign in to comment.