Permalink
Browse files

Remove usage of main preference file for theme settings.

Instead use TM_CURRENT_THEME_PATH and the TM_QUERY tool.
  • Loading branch information...
1 parent c1ff1cc commit 9ed7f4623b61c0519170852cf30b8aa425e5447e @infininight infininight committed Sep 25, 2012
Showing with 3 additions and 12 deletions.
  1. +3 −12 Commands/Show Scope (HTML).tmCommand
View
15 Commands/Show Scope (HTML).tmCommand
@@ -81,16 +81,7 @@ module Textpow
end
end
-# Load TM preferences to discover the current theme and font settings
-textmate_pref_file = "~/Library/Preferences/#{ENV['TM_APP_IDENTIFIER'] || 'com.macromates.textmate'}.plist"
-
-prefs = OSX::PropertyList.load(File.open(File.expand_path(textmate_pref_file)))
-theme_uuid = prefs['themeUUID']
-# Load the active theme. Unfortunately, this requires us to scan through
-# all discoverable theme files...
-unless theme_plist = find_theme(theme_uuid)
- abort "Could not locate your theme file!" unless theme_plist = find_theme('766026CB-703D-4610-B070-8DE07D967C5F')
-end
+theme_plist = load_theme
scorer = Textpow::ScoreManager.new
@@ -103,8 +94,8 @@ end while scopes.pop and not scopes.empty?
body_bg = '#fff'
body_fg = '#000'
-font_name = prefs['OakTextViewNormalFontName'] || 'Monaco'
-font_size = (prefs['OakTextViewNormalFontSize'] || 11).to_s
+font_name = `"$TM_QUERY" --setting fontName`.chomp || 'Menlo-Regular'
+font_size = (`"$TM_QUERY" --setting fontSize`.chomp || 12).to_s
font_size.sub!(/\.\d+$/, '')
FONT_MAP.each do | font_re, font_alt |

0 comments on commit 9ed7f46

Please sign in to comment.