Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more keymaps

  • Loading branch information...
commit eb23ba3fe05d62b36b7542cc710a35392592619d 1 parent 667f4b4
@glucero authored
View
8 source/conf/configuration.json
@@ -3,12 +3,14 @@
"small_workspace"
],
"keymap": {
- "main_window": "RETURN+COMMAND+SHIFT",
- "remove_all_windows": "Q+COMMAND+SHIFT",
+ "set_main_window": "RETURN+COMMAND+SHIFT",
+ "zoom_focused_window": "Z+COMMAND+SHIFT",
+ "swap_focused_window_with_main": "SPACE+COMMAND+SHIFT",
"rotate_layout_counterclockwise": "K+COMMAND+SHIFT",
"rotate_layout_clockwise": "J+COMMAND+SHIFT",
"activate_previous_window": "H+COMMAND+SHIFT",
- "activate_next_window": "L+COMMAND+SHIFT"
+ "activate_next_window": "L+COMMAND+SHIFT",
+ "remove_all_windows": "Q+COMMAND+SHIFT"
}
}
View
46 source/lib/fusuma/keymap.rb
@@ -6,6 +6,34 @@ class KeyMap
attr_reader :keys, :layout
+ def zoom_focused_window
+ # center the focused window and set its dimensions to be slightly smaller
+ # than the desktop's
+ log.debug "Zooming the focused window."
+ window = Application.active.focused_window
+ desktop = window.location
+
+ window.position = desktop.size.to_a.map { |v| v * 0.1 }
+ window.dimensions = desktop.size.to_a.map { |v| v * 0.85 }
+ end
+
+ def swap_focused_window_with_main
+ # swap the focused window's current position with the main window
+ focused_window = Application.active.focused_window
+ if layout.include? focused_window
+ main = layout.main
+ index = layout.index(focused_window)
+
+ log.debug "Swapping the main window's position with window #{index}."
+
+ layout.shift
+ layout.insert(index, main)
+ layout.prepend(focused_window)
+
+ apply_layout
+ end
+ end
+
def activate_next_window
# find the active window in the layout and activate the previous window
# without changing the layout or positioning of any windows
@@ -28,7 +56,7 @@ def activate_previous_window
def rotate_layout_clockwise
# make the last window the main(first) window and reorganize the windows
log.debug "Rotating the layout clockwise."
- layout.prepend layout.last
+ layout.rotate!
apply_layout
activate_previous_window
@@ -37,13 +65,13 @@ def rotate_layout_clockwise
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
+ layout.rotate!(-1)
apply_layout
activate_next_window
end
- def main_window
+ def set_main_window
# make the active window the main(first) window (if it's not in the layout,
# add it) and reorganize the windows
log.debug "Setting the active window as layout's main window."
@@ -51,17 +79,7 @@ def main_window
apply_layout
end
- def master
- if layout.main.eql? Window.active
- log.debug "The active window is already the main window."
- remove_active_window
- else
- log.debug "This active window is not in the layout or is not the main window."
- main_window
- end
- end
-
- def remove_active_window
+ def remove_focused_window
log.debug "Removing the active window from the layout."
layout.remove Window.active
apply_layout
View
4 source/lib/fusuma/layout.rb
@@ -6,6 +6,8 @@ class Layout < Array
attr_accessor :frames, :scale
+ alias_method :main, :first
+
def self.all
layouts = Dir.glob(File.join(LAYOUTS, '**.json'))
@@ -51,8 +53,6 @@ def remove(window)
reject! { |w| w.eql? window }
end
- def main() first end
-
def append(window)
# Remove the window if it already exists, then add it to the end of the
# layout and remove any extra windows from the beginning of the layout.
Please sign in to comment.
Something went wrong with that request. Please try again.