Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
display/status/arrange: persistent view arrangements
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
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |