Skip to content

Instantly share code, notes, and snippets.

@victusfate
Created March 1, 2011 13:52
Show Gist options
  • Select an option

  • Save victusfate/849150 to your computer and use it in GitHub Desktop.

Select an option

Save victusfate/849150 to your computer and use it in GitHub Desktop.
# controller.rb
# KeyBinder
#
# Created by messel on 2/14/11.
# Copyright 2011 Victus Media. All rights reserved.
class Controller < NSWindowController
attr_writer :button
attr_accessor :keyBindings
# def initWithFrame(frame)
# super(frame)
def init
@keyBindings = '{
/* home default */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* end */
"\UF72B" = "moveToEndOfLine:";
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* page up/down */
"\UF72C" = "pageUp:";
"\UF72D" = "pageDown:";
}'
return self
end
def setKeyBinding(sender)
puts "Bacon!"
# dest = '~/Library/KeyBindings'
dest = '/Users/messel/Desktop/KeyBindings'
file = '/DefaultKeyBinding.dict'
Dir.mkdir(dest) unless File.directory? dest
fdest = "#{dest}#{file}"
puts fdest
puts ""
puts "keyBindings contents #{@keyBindings}"
# out = File.new(fdest,'w+')
# out << @keyBindings
# out.close
end
def takeStringFrom(sender)
@keyBindings = sender.stringValue
puts "takeStringFrom textfield keyBindings: #{@keyBindings}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment