Use duti to set default

This commit is contained in:
js0ny 2024-11-08 16:45:20 +00:00
parent 36855e9c0f
commit 14763de21a
2 changed files with 89 additions and 138 deletions

View file

@ -1,121 +0,0 @@
{
"description": "lctrl + p/n/b/f/a/e to up/down/left/right/home/end",
"manipulators": [
{
"from": {
"key_code": "p",
"modifiers": {
"mandatory": [
"left_control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "n",
"modifiers": {
"mandatory": [
"left_control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "b",
"modifiers": {
"mandatory": [
"left_control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "f",
"modifiers": {
"mandatory": [
"left_control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"left_control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": "command"
}
],
"type": "basic"
},
{
"from": {
"key_code": "e",
"modifiers": {
"mandatory": [
"left_control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": "command"
}
],
"type": "basic"
}
]
}

View file

@ -1,16 +1,18 @@
#! /bin/zsh #! /bin/zsh
# This script is used to setup a new mac # This script is used to setup a new mac
echo "Running the setup script"
# Xcode Command Line Tools # Xcode Command Line Tools
echo [INFO] Installing Xcode Command Line Tools echo "[INFO] Installing Xcode Command Line Tools"
xcode-select --install xcode-select --install
# System Preferences # System Preferences
# Installation Sources # Installation Sources
echo [INFO] Setting Installation Sources echo "[INFO] Setting Installation Sources"
sudo spctl --master-disable sudo spctl --master-disable
## Finder ## Finder
echo [INFO] Setting Finder Preferences echo "[INFO] Setting Finder Preferences"
defaults write com.apple.finder QuitMenuItem -bool true # Quit with CMD+Q defaults write com.apple.finder QuitMenuItem -bool true # Quit with CMD+Q
defaults write com.apple.finder AppleShowAllFiles -bool false # Don't show Hidden Files defaults write com.apple.finder AppleShowAllFiles -bool false # Don't show Hidden Files
defaults write com.apple.finder ShowPathbar -bool true # Show Path Bar defaults write com.apple.finder ShowPathbar -bool true # Show Path Bar
@ -28,7 +30,7 @@ defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
killall Finder killall Finder
## Dock ## Dock
echo [INFO] Setting Dock Preferences echo "[INFO] Setting Dock Preferences"
defaults write com.apple.dock persistent-apps -array defaults write com.apple.dock persistent-apps -array
defaults write com.apple.dock persistent-others -array defaults write com.apple.dock persistent-others -array
defaults write com.apple.dock autohide -bool true # Autohide Dock defaults write com.apple.dock autohide -bool true # Autohide Dock
@ -36,30 +38,31 @@ defaults write com.apple.dock autohide-time-modifier -float 0.5
defaults write com.apple.dock autohide-delay -float 0 # Immediately Autohide Dock defaults write com.apple.dock autohide-delay -float 0 # Immediately Autohide Dock
defaults write com.apple.dock show-recents -bool false # Hide Recent Applications defaults write com.apple.dock show-recents -bool false # Hide Recent Applications
## Trackpad ## Trackpad
echo "[INFO] Setting Trackpad Preferences"
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# Development # # Development #
### Dotfiles Setup ### ### Dotfiles Setup ###
echo [INFO] Setting Up Dotfiles echo "[INFO] Setting Up Dotfiles"
export $DOTFILES="$HOME/.dotfiles" export $DOTFILES="$HOME/.dotfiles"
git clone https://www.github.com/js0ny/dotfiles.git $DOTFILES git clone https://www.github.com/js0ny/dotfiles.git $DOTFILES
ln -sf $DOTFILES/zsh/.zshenv ~/.zshenv ln -sf $DOTFILES/zsh/.zshenv ~/.zshenv
echo [INFO] 'source ~/.zshenv' to use XDG_CONFIG_HOME echo "[INFO] 'source ~/.zshenv' to use XDG_CONFIG_HOME"
source ~/.zshenv source ~/.zshenv
# export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" # export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
# export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" # export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
echo [INFO] Setting Up Oh-My-Zsh echo "[INFO] Setting Up Oh-My-Zsh"
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
ln -sf $DOTFILES/zsh/.zshenv ~/.zshenv ln -sf $DOTFILES/zsh/.zshenv ~/.zshenv
ln -sf $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc ln -sf $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc
source $XDG_CONFIG.vimrc_HOME/zsh/.zshrc source $XDG_CONFIG/zsh/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH/custom/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting
source $XDG_CONFIG_HOME/zsh/.zshrc source $XDG_CONFIG_HOME/zsh/.zshrc
echo [INFO] Setting Up dotfiles echo "[INFO] Setting Up dotfiles"
mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet
mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory
# $DOTFILES/.config # $DOTFILES/.config
@ -82,10 +85,10 @@ ln -sf $DOTFILES/.npmrc ~/.npmrc
ln -sf $DOTFILES/.tmux.conf ~/.tmux.conf ln -sf $DOTFILES/.tmux.conf ~/.tmux.conf
# Brew # Brew
echo [INFO] Installing Homebrew echo "[INFO] Installing Homebrew"
echo [ACTION] Request Human Input echo "[ACTION] Request Human Input"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo [INFO] Installing Brew Packages echo "[INFO] Installing Softwares"
brew install mas # Mac App Store CLI brew install mas # Mac App Store CLI
# File Management # File Management
@ -104,6 +107,9 @@ brew install --formula tmux
brew install --formula tree brew install --formula tree
brew install --formula pandoc brew install --formula pandoc
brew install --formula zellij # Better Tmux for me brew install --formula zellij # Better Tmux for me
brew install --formula wget
brew install --formula wget2
brew install --formula speedtest-cli
# Editors # Editors
brew install --cask visual-studio-code brew install --cask visual-studio-code
@ -112,12 +118,14 @@ brew install --formula neovide
# IDE # IDE
brew install --cask qt-creator brew install --cask qt-creator
brew install --cask rider
# Programming Languages # Programming Languages
brew install --formula lua brew install --formula lua
brew install --formula luajit brew install --formula luajit
brew install --formula node brew install --formula node
brew install --formula dotnet brew install --formula dotnet
brew install --formula go
# brew install --formula rust # brew install --formula rust
brew install --cask miniconda brew install --cask miniconda
@ -131,8 +139,6 @@ brew install --cask utools
# Terminals # Terminals
brew install --cask iterm2 brew install --cask iterm2
brew install --cask follow
brew install --formula dotnet
# IME # IME
brew install --cask squirrel brew install --cask squirrel
@ -156,7 +162,8 @@ brew install --cask ltspice
brew install --cask mactex-no-gui brew install --cask mactex-no-gui
# Browser # Browser
brew install --cask vivaldi brew install --cask edge # Default
brew install --cask arc
brew install --cask firefox@nightly brew install --cask firefox@nightly
# Fonts # Fonts
@ -165,11 +172,11 @@ brew install --cask font-caskaydia-cove-nerd-font
brew install --cask font-lxgw-wenkai brew install --cask font-lxgw-wenkai
# Quick Look # Quick Look
brew install --cask qlmarkdown brew install --cask qlcolorcode qlstephen qlmarkdown quicklook-json qlimagesize suspicious-package apparency quicklookase qlvideo
# Utilities # Utilities
brew install --cask rustdesk brew install --cask rustdesk
brew install --cask logi-options+ # brew install --cask logi-options+ # NBCS
mas install 1452453066 # Hidden Bar mas install 1452453066 # Hidden Bar
brew install ticktick # To-do List brew install ticktick # To-do List
brew install --cask zotero # Reference Manager brew install --cask zotero # Reference Manager
@ -177,7 +184,10 @@ brew install --cask betterdisplay
brew install --cask karabiner-elements # Keyboard Customization brew install --cask karabiner-elements # Keyboard Customization
brew install --cask scroll-reverser # Let Trackpad and Mouse Scroll in the Same Direction like Windows brew install --cask scroll-reverser # Let Trackpad and Mouse Scroll in the Same Direction like Windows
# brew install --cask orbstack # VM # brew install --cask orbstack # VM
# brew install --cask docker
brew install --cask clash-verge-rev brew install --cask clash-verge-rev
brew install --cask chatbox # LLM API Caller
brew install --cask follow # RSS Reader
# Social # Social
@ -185,3 +195,65 @@ brew install --cask telegram-desktop
mas install 836500024 # WeChat mas install 836500024 # WeChat
mas install 451108668 # QQ mas install 451108668 # QQ
# plum (Rime IME)
curl -fsSL https://raw.githubusercontent.com/rime/plum/master/rime-install | bash
# Set default apps (duti)
# The id of the app can be found by running
# `osascript -e 'id of app "AppName"'`
echo "[INFO] Setting Default Apps"
# Markdown -> Typora
duti -s abnerworks.Typora .md all
duti -s abnerworks.Typora .markdown all
# PDF -> Skim
duti -s net.sourceforge.skim-app.skim .pdf all
# Raw Text -> Neovide
duti -s com.neovide.neovide .txt all
# Archive -> Keka
duti -s com.aone.keka .zip all
duti -s com.aone.keka .rar all
duti -s com.aone.keka .7z all
duti -s com.aone.keka .tar all
# Source Code Light -> Neovim
duti -s com.neovide.neovide .gitingore all
duti -s com.neovide.neovide .vimrc all
duti -s com.neovide.neovide .vim all
duti -s com.neovide.neovide .lua all
duti -s com.neovide.neovide .py all
duti -s com.neovide.neovide .jl all
# Source Code Heavy -> VSCode
duti -s com.microsoft.VSCode .c all
# Source Code DOTNET -> VSCode
duti -s com.microsoft.VSCode .cs all
duti -s com.microsoft.VSCode .fs all
duti -s com.microsoft.VSCode .fsx all
duti -s com.microsoft.VSCode .csx all
duti -s com.microsoft.VSCode .ps1 all
# Source Code Web -> VSCode
duti -s com.microsoft.VSCode .js all
duti -s com.microsoft.VSCode .ts all
duti -s com.microsoft.VSCode .jsx all
duti -s com.microsoft.VSCode .tsx all
duti -s com.microsoft.VSCode .css all
duti -s com.microsoft.VSCode .scss all
duti -s com.microsoft.VSCode .sass all
duti -s com.microsoft.VSCode .vue all
# Source Code Config -> Neovim
duti -s com.neovide.neovide .json all
duti -s com.neovide.neovide .yaml all
duti -s com.neovide.neovide .yml all
duti -s com.neovide.neovide .toml all
duti -s com.neovide.neovide .ini all
duti -s com.neovide.neovide .cfg all
duti -s com.neovide.neovide .conf all
duti -s com.neovide.neovide .kdl all
duti -s com.neovide.neovide .xml all
# Source Code Jupyter -> VSCode
duti -s com.microsoft.VSCode .ipynb all
# Source Code DotNet Project -> Rider
duti -s com.jetbrains.rider .sln all
duti -s com.jetbrains.rider .csproj all
duti -s com.jetbrains.rider .fsproj all
# Video -> IINA
duti -s com.colliderli.iina .mp4 all
duti -s com.colliderli.iina .mkv all