Permalink
Browse files

when rotating the layout activate the window from the opposite direct…

…ion (so that focused stays in the same place) and added maps for activating windows by index 1-10
  • Loading branch information...
1 parent b428c75 commit e2271fa037ef37196c8c826b948c93ab0db30644 @glucero committed Oct 25, 2012
Showing with 55 additions and 0 deletions.
  1. +55 −0 source/lib/fusuma/keymap.rb
@@ -30,13 +30,17 @@ def rotate_layout_clockwise
log.debug "Rotating the layout clockwise."
layout.prepend layout.last
apply_layout
+
+ activate_previous_window
end
def rotate_layout_counterclockwise
# make the main(first) window the last window and reorganize the windows
log.debug "Rotating the layout counter clockwise."
layout.append layout.first
apply_layout
+
+ activate_next_window
end
def main_window
@@ -73,6 +77,57 @@ def remove_all_windows
layout.clear
end
+ # a set of mappings to activate windows by layout index
+ def activate_window_1
+ log.debug "Activating window 1."
+ layout[0].activate
+ end
+
+ def activate_window_2
+ log.debug "Activating window 2."
+ layout[1].activate
+ end
+
+ def activate_window_3
+ log.debug "Activating window 3."
+ layout[2].activate
+ end
+
+ def activate_window_4
+ log.debug "Activating window 4."
+ layout[3].activate
+ end
+
+ def activate_window_5
+ log.debug "Activating window 5."
+ layout[4].activate
+ end
+
+ def activate_window_6
+ log.debug "Activating window 6."
+ layout[5].activate
+ end
+
+ def activate_window_7
+ log.debug "Activating window 7."
+ layout[6].activate
+ end
+
+ def activate_window_8
+ log.debug "Activating window 8."
+ layout[7].activate
+ end
+
+ def activate_window_9
+ log.debug "Activating window 9."
+ layout[8].activate
+ end
+
+ def activate_window_10
+ log.debug "Activating window 10."
+ layout[9].activate
+ end
+
def add(action, sequence)
keys.addHotString(sequence, &(-> { send(action.to_sym) }))
end

0 comments on commit e2271fa

Please sign in to comment.