Merge pull request #216 from github/user-prefs

Load settings from user.coffee and user.css
This commit is contained in:
Justin Palmer
2013-01-31 10:36:23 -08:00
6 changed files with 33 additions and 6 deletions

8
.atom/user.css Normal file
View File

@@ -0,0 +1,8 @@
// User styles
.tree-view {
}
.editor {
}

View File

@@ -21,7 +21,7 @@ Requirements
Atom is installed! Type `atom [path]` from the commmand line or find it in `/Applications/Atom.app`
## Your ~/.atom Directory
A basic ~/.atom directory is installed when you run `rake install`. Take a look at ~/.atom/atom.coffee for more information.
A basic ~/.atom directory is installed when you run `rake install`. Take a look at ~/.atom/user.coffee for more information.
## Basic Keyboard shortcuts
Atom doesn't have much in the way of menus yet. Use these keyboard shortcuts to
@@ -53,7 +53,7 @@ Most default OS X keybindings also work.
## Init Script
Atom will require `~/.atom/atom.coffee` whenever a window is opened or reloaded if it is present in your
Atom will require `~/.atom/user.coffee` whenever a window is opened or reloaded if it is present in your
home directory. This is a rudimentary jumping off point for your own customizations.
## Command Panel

View File

@@ -76,12 +76,25 @@ task "create-dot-atom" do
dot_atom_template_path = ATOM_SRC_PATH + "/.atom"
replace_dot_atom = false
next if File.exists?(DOT_ATOM_PATH)
if File.exists?(DOT_ATOM_PATH)
user_config = "#{DOT_ATOM_PATH}/user.coffee"
old_user_config = "#{DOT_ATOM_PATH}/atom.coffee"
if File.exists?(old_user_config)
`mv #{old_user_config} #{user_config}`
puts "\033[32mRenamed #{old_user_config} to #{user_config}\033[0m"
end
next
end
`rm -rf "#{DOT_ATOM_PATH}"`
`mkdir "#{DOT_ATOM_PATH}"`
`cp "#{dot_atom_template_path}/atom.coffee" "#{DOT_ATOM_PATH}"`
`cp "#{dot_atom_template_path}/packages" "#{DOT_ATOM_PATH}"`
`cp "#{dot_atom_template_path}/user.coffee" "#{DOT_ATOM_PATH}"`
`cp "#{dot_atom_template_path}/user.css" "#{DOT_ATOM_PATH}"`
`cp -r "#{dot_atom_template_path}/packages" "#{DOT_ATOM_PATH}"`
`cp -r "#{ATOM_SRC_PATH}/themes" "#{DOT_ATOM_PATH}"`
`cp "#{ATOM_SRC_PATH}/vendor/themes/IR_Black.tmTheme" "#{DOT_ATOM_PATH}/themes"`
end

View File

@@ -53,10 +53,16 @@ _.extend atom,
themeNames = config.get("core.themes") ? ['Atom - Dark', 'IR_Black']
themeNames = [themeNames] unless _.isArray(themeNames)
@loadTheme(themeName) for themeName in themeNames
@loadUserStylesheet()
loadTheme: (name) ->
@loadedThemes.push Theme.load(name)
loadUserStylesheet: ->
userStylesheetPath = fs.join(config.configDirPath, 'user.css')
if fs.isFile(userStylesheetPath)
applyStylesheet(userStylesheetPath, fs.read(userStylesheetPath), 'userTheme')
getAtomThemeStylesheets: ->
themeNames = config.get("core.themes") ? ['Atom - Dark', 'IR_Black']
themeNames = [themeNames] unless _.isArray(themeNames)

View File

@@ -4,7 +4,7 @@ EventEmitter = require 'event-emitter'
configDirPath = fs.absolute("~/.atom")
configJsonPath = fs.join(configDirPath, "config.json")
userInitScriptPath = fs.join(configDirPath, "atom.coffee")
userInitScriptPath = fs.join(configDirPath, "user.coffee")
bundledPackagesDirPath = fs.join(resourcePath, "src/packages")
bundledThemesDirPath = fs.join(resourcePath, "themes")
vendoredPackagesDirPath = fs.join(resourcePath, "vendor/packages")