Skip to content

Commit e67f88f

Browse files
author
Kevin Suttle
committed
Update to ref 1f6ead4
mathiasbynens/dotfiles@1f6ead4
1 parent 25a8173 commit e67f88f

File tree

1 file changed

+46
-9
lines changed

1 file changed

+46
-9
lines changed

.osx

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ defaults write com.apple.dock show-process-indicators -bool true
365365
# Wipe all (default) app icons from the Dock
366366
# This is only really useful when setting up a new Mac, or if you don’t use
367367
# the Dock to launch apps.
368-
#defaults write com.apple.dock persistent-apps -array ""
368+
#defaults write com.apple.dock persistent-apps -array
369369

370370
# Don’t animate opening applications from the Dock
371371
defaults write com.apple.dock launchanim -bool false
@@ -564,14 +564,51 @@ sudo mdutil -E / > /dev/null
564564
defaults write com.apple.terminal StringEncodings -array 4
565565

566566
# Use a modified version of the Solarized Dark theme by default in Terminal.app
567-
TERM_PROFILE='Solarized Dark xterm-256color';
568-
CURRENT_PROFILE="$(defaults read com.apple.terminal 'Default Window Settings')";
569-
if [ "${CURRENT_PROFILE}" != "${TERM_PROFILE}" ]; then
570-
open "${HOME}/init/${TERM_PROFILE}.terminal";
571-
sleep 1; # Wait a bit to make sure the theme is loaded
572-
defaults write com.apple.terminal 'Default Window Settings' -string "${TERM_PROFILE}";
573-
defaults write com.apple.terminal 'Startup Window Settings' -string "${TERM_PROFILE}";
574-
fi;
567+
osascript <<EOD
568+
569+
tell application "Terminal"
570+
571+
local allOpenedWindows
572+
local initialOpenedWindows
573+
local windowID
574+
set themeName to "Solarized Dark xterm-256color"
575+
576+
(* Store the IDs of all the open terminal windows. *)
577+
set initialOpenedWindows to id of every window
578+
579+
(* Open the custom theme so that it gets added to the list
580+
of available terminal themes (note: this will open two
581+
additional terminal windows). *)
582+
do shell script "open '$HOME/init/" & themeName & ".terminal'"
583+
584+
(* Wait a little bit to ensure that the custom theme is added. *)
585+
delay 1
586+
587+
(* Set the custom theme as the default terminal theme. *)
588+
set default settings to settings set themeName
589+
590+
(* Get the IDs of all the currently opened terminal windows. *)
591+
set allOpenedWindows to id of every window
592+
593+
repeat with windowID in allOpenedWindows
594+
595+
(* Close the additional windows that were opened in order
596+
to add the custom theme to the list of terminal themes. *)
597+
if initialOpenedWindows does not contain windowID then
598+
close (every window whose id is windowID)
599+
600+
(* Change the theme for the initial opened terminal windows
601+
to remove the need to close them in order for the custom
602+
theme to be applied. *)
603+
else
604+
set current settings of tabs of (every window whose id is windowID) to settings set themeName
605+
end if
606+
607+
end repeat
608+
609+
end tell
610+
611+
EOD
575612

576613
# Enable “focus follows mouse” for Terminal.app and all X11 apps
577614
# i.e. hover over a window and start typing in it without clicking first

0 commit comments

Comments
 (0)