Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

these too

  • Loading branch information...
commit dcdf79002113b30ad08b7175fa65183402c69e08 1 parent 12fdf22
@glucero authored
Showing with 89 additions and 21 deletions.
  1. +55 −2 README.md
  2. +34 −19 build_app
View
57 README.md
@@ -20,6 +20,61 @@ fusuma has been written in MacRuby, [and who doesn't like Ruby](http://www.youtu
***
+### how does it work?
+
+fusuma defines a layout for each active display:
+
+ (example my_layout.json)
+
+ {
+ "name": "my_layout", # each layout defines its own scale so
+ "scale": { # we can use the same layout with many
+ "origin": [ 0, 0 ], # different display dimensions.
+ "size": [ 120, 120 ]
+ }, # each layout's frame defines the layout
+ "frames": [ # for each window (and maximum number of
+ [ # windows that can be controlled).
+ {
+ "position": [ 0, 0 ], # if there is 1 window in the layout,
+ "dimensions": [ 120, 120 ] # frame 1 will maximize the window.
+ }
+ ],
+ [
+ {
+ "position": [ 60, 0 ],
+ "dimensions": [ 60, 120 ] # if there are two windows in the layout,
+ }, # frame 2 will split the desktop down the
+ { # middle with the 'main' window on the
+ "position": [ 0, 0 ], # and the secondary window on the left
+ "dimensions": [ 60, 120 ]
+ }
+ ]
+ ]
+ }
+
+
+each layout defines a 'frame' for each window layout configuration:
+
+ (example configuration.json)
+
+ {
+ "layouts": [ # layouts are matched to active displays
+ "small_workspace", # primary monitor
+ "large_workspace" # secondary monitor
+ ],
+ "keymap": { # keymap actions reference methods in keymap.rb
+ "master": "RETURN+COMMAND+SHIFT",
+ "remove_all_windows": "Q+COMMAND+SHIFT",
+ "rotate_layout_counterclockwise": "K+COMMAND+SHIFT", # *** WARNING ***
+ "rotate_layout_clockwise": "J+COMMAND+SHIFT", # these keymaps are global, map carefully.
+ "activate_previous_window": "H+COMMAND+SHIFT", # *** WARNING ***
+ "activate_next_window": "L+COMMAND+SHIFT"
+ }
+ }
+
+
+***
+
### todo
* clean up and documentation (this is an ongoing todo item)
@@ -43,8 +98,6 @@ fusuma has been written in MacRuby, [and who doesn't like Ruby](http://www.youtu
### license
- MIT License
-
Copyright (C) 2012 Gino Lucero
Permission is hereby granted, free of charge, to any person obtaining a
View
53 build_app
@@ -6,7 +6,7 @@ module Fusuma
require 'fileutils'
APP_NAME = 'fusuma'
- VERSION = '1.0.0'
+ VERSION = '0.1.0'
class Build
@@ -25,13 +25,13 @@ module Fusuma
# MACRUBY_DIR = File.join(FRAMEWORKS_DIR, 'MacRuby.framework') # TODO: embed MacRuby
INFO_PLIST_FILE = File.join(CONTENTS_DIR, 'Info.plist')
MACOS_DIR = File.join(CONTENTS_DIR, 'MacOS')
- EXECUTABLE_FILE = File.join(MACOS_DIR, "#{APP_NAME}")
+ EXECUTABLE_FILE = File.join(MACOS_DIR, APP_NAME)
PROFILE_DIR = File.join(CONTENTS_DIR, 'Profile')
RESOURCES_DIR = File.join(CONTENTS_DIR, 'Resources')
LICENSE_FILE = File.join(PROJECT_ROOT, 'LICENSE.txt')
APP_BIN_DIR = File.join(RESOURCES_DIR, 'bin')
APP_CONF_DIR = File.join(RESOURCES_DIR, 'conf')
- # ICON_FILE = File.join(RESOURCES_DIR, 'fusuma.icns') # TODO: make icon
+ # ICON_FILE = File.join(RESOURCES_DIR, "#{APP_NAME}.icns") # TODO: make icon
APP_LIB_DIR = File.join(RESOURCES_DIR, 'lib')
VERSION_FILE = File.join(APP_LIB_DIR, 'version.rb')
APP_LOG_DIR = File.join(RESOURCES_DIR, 'log')
@@ -86,46 +86,61 @@ cd "`dirname $0`/../Resources"
TEXT
VERSION_CONTENTS = <<-TEXT
-module Fusuma
+module #{APP_NAME.capitalize}
VERSION = "#{VERSION}"
end
TEXT
def create_directories
- [FRAMEWORKS_DIR, MACOS_DIR, PROFILE_DIR, APP_LOG_DIR].each do |directory|
+ # FileUtils.makedirs will create all parent directories needed
+ directories = [FRAMEWORKS_DIR, MACOS_DIR, PROFILE_DIR, APP_LOG_DIR]
+
+ directories.each do |directory|
FileUtils.makedirs directory
end
end
+ def copy_source
+ # each source directory constant is paired with a target app directory
+ # ex. SOURCE_BIN_DIR is paired with APP_BIN_DIR
+ source = %w(BIN CONF LIB VENDOR)
+
+ source.each do |directory|
+ values = %w(SOURCE APP).each
+ copy_dir { Build.const_get "#{values.next}_#{directory}_DIR" }
+ end
+ end
+
+ def copy_dir
+ FileUtils.copy_entry(yield, yield)
+ end
+
def create_files
- %w(BUILD_STAMP INFO_PLIST EXECUTABLE LICENSE VERSION_PLIST VERSION).each do |file|
+ # each file name constant is paired with a file contents constant.
+ # ex. EXECUTABLE_FILE is paired with EXECUTABLE_CONTENTS
+ files = %w(BUILD_STAMP INFO_PLIST EXECUTABLE LICENSE VERSION_PLIST VERSION)
+
+ files.each do |file|
values = %w(FILE CONTENTS).each
write_file { Build.const_get "#{file}_#{values.next}" }
end
- File.chmod(0766, EXECUTABLE_FILE)
+ File.chmod(0766, EXECUTABLE_FILE) # make app launcher executable
end
def write_file
File.open(yield, 'w') { |f| f.write yield }
end
- def copy_source
- %w(BIN CONF LIB VENDOR).each do |directory|
- values = %w(SOURCE APP).each
- copy_dir { Build.const_get "#{values.next}_#{directory}_DIR" }
- end
- end
-
- def copy_dir
- FileUtils.copy_entry(yield, yield)
- end
-
def initialize
create_directories
copy_source
-
create_files
+
+ puts "#{APP_NAME} has been created and saved to #{OSX_APP_DIR}."
+ rescue => error
+ puts error.message
+ puts error.backtrace.join("\n")
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.