ソースを参照

refactor: use vars in install to make keyboard app shortcuts easier to read

Kyle P Davis 1 年間 前
コミット
4e45db9fba
1 ファイル変更14 行追加8 行削除
  1. 14 8
      install.sh

+ 14 - 8
install.sh

@@ -42,13 +42,19 @@ link "$CMD_DIR/.profile" "$HOME/.bash_profile" # certain scenarios use this one
 
 OS=$(uname -s)
 if [ "$OS" = "Darwin" ]; then
-	# Enable "All Controls" for tab in SystemPreferences->Keyboard->Shortcuts
+	# Enable "All Controls" for tab in: System Settings > Keyboard > Keyboard navigation
 	defaults write -globalDomain AppleKeyboardUIMode -int 3
-	# Setup things for SystemPreferences->Keyboard->Shortcuts->App Shortcuts
-	defaults write -globalDomain NSUserKeyEquivalents -dict \
-		'\033Window\033Zoom' '@~^m' \
-		'\033Window\033Move Window to Left Side of Screen' '@~^\U2190' \
-		'\033Window\033Move Window to Right Side of Screen' '@~^\U2192' \
-		'\033Window\033Tile Window to Left of Screen' '@~^$\U2190' \
-		'\033Window\033Tile Window to Right of Screen' '@~^$\U2192'
+
+	# Setup things for: System Settings > Keyboard > Keyboard Shortcuts > App Shortcuts
+	Sep="\033" KCmd='@' KOpt='~' KCtrl='^' KShift='$' KLeft='\U2190' KRight='\U2192'
+	defaults write -globalDomain NSUserKeyEquivalents -dict-add \
+		"${Sep}Window${Sep}Zoom" "${KCmd}${KOpt}${KCtrl}m" \
+		"${Sep}Window${Sep}Move Window to Left Side of Screen" "${KCmd}${KOpt}${KCtrl}${KLeft}" \
+		"${Sep}Window${Sep}Move Window to Right Side of Screen" "${KCmd}${KOpt}${KCtrl}${KRight}" \
+		"${Sep}Window${Sep}Tile Window to Left of Screen" "${KCmd}${KOpt}${KCtrl}${KShift}${KLeft}" \
+		"${Sep}Window${Sep}Tile Window to Right of Screen" "${KCmd}${KOpt}${KCtrl}${KShift}${KRight}" \
+		"${Sep}Window${Sep}Move Window Back to Mac" "${KCmd}${KOpt}${KCtrl}1"
+
+	# Nudge the prefs daemon to reload things
+	killall cfprefsd
 fi