Fix HUD behavior and installer host checks
This commit is contained in:
@@ -16,7 +16,7 @@ From your users home directory (~/), execute:
|
||||
To install oh-my-zsh and symlink the config files run:
|
||||
```sh .config/dotfiles/install.sh```
|
||||
|
||||
This replaces the managed dotfiles in your home directory (`.zshrc`, `.zprofile`, `.gitconfig`, `.p10k.zsh`, `~/.config/kitty`, `~/.config/nvim`, and `~/.config/tmux`). On macOS it also links `~/.config/karabiner/karabiner.json` and `~/.config/karabiner/assets`, while leaving Karabiner's local backup files unmanaged.
|
||||
This replaces the managed dotfiles in your home directory (`.zshrc`, `.zprofile`, `.gitconfig`, `.p10k.zsh`, `~/.config/kitty`, `~/.config/nvim`, and `~/.config/tmux`). On macOS it also links `~/.config/karabiner/karabiner.json` and `~/.config/karabiner/assets`, while leaving Karabiner's local backup files unmanaged. The Kitty HUD display pin lives in a host-specific file and is only installed on the host named `studio`.
|
||||
|
||||

|
||||
[original image, 1.8M](https://24unix.net/build/images/Settings/user_screen_original.png)
|
||||
|
||||
3
hosts/studio/kitty/quick-access-terminal.conf
Normal file
3
hosts/studio/kitty/quick-access-terminal.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
# Pin the quick access terminal to the center display instead of following the
|
||||
# active monitor when it is toggled open.
|
||||
output_name LU28R55
|
||||
80
install.sh
80
install.sh
@@ -49,13 +49,20 @@ command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
require_command() {
|
||||
command_name=$1
|
||||
is_macos() {
|
||||
[ "$(uname -s)" = "Darwin" ]
|
||||
}
|
||||
|
||||
if ! command_exists "$command_name"; then
|
||||
error "$command_name is required but not installed. Install it first via your package manager."
|
||||
exit 1
|
||||
current_host_name() {
|
||||
if is_macos && command_exists scutil; then
|
||||
scutil --get LocalHostName 2>/dev/null && return
|
||||
fi
|
||||
|
||||
hostname -s 2>/dev/null || hostname
|
||||
}
|
||||
|
||||
is_studio_host() {
|
||||
[ "$(current_host_name)" = "studio" ]
|
||||
}
|
||||
|
||||
error() {
|
||||
@@ -88,21 +95,16 @@ setup_color() {
|
||||
apply_dotfiles() {
|
||||
echo "${BLUE}Applying dotfiles...${RESET}"
|
||||
|
||||
require_command lsd
|
||||
require_command tmux
|
||||
require_command nvim
|
||||
require_command rg
|
||||
|
||||
remove_legacy_dotfile "$HOME/.vimrc"
|
||||
link_dotfile "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc"
|
||||
link_dotfile "$DOTFILES_DIR/.zprofile" "$HOME/.zprofile"
|
||||
link_dotfile "$DOTFILES_DIR/.gitconfig" "$HOME/.gitconfig"
|
||||
link_dotfile "$DOTFILES_DIR/.p10k.zsh" "$HOME/.p10k.zsh"
|
||||
mkdir -p "$HOME/.config"
|
||||
link_dotfile "$DOTFILES_DIR/kitty" "$HOME/.config/kitty"
|
||||
install_kitty_config
|
||||
link_dotfile "$DOTFILES_DIR/nvim" "$HOME/.config/nvim"
|
||||
link_dotfile "$DOTFILES_DIR/tmux" "$HOME/.config/tmux"
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
if is_macos; then
|
||||
install_karabiner_config
|
||||
fi
|
||||
install_fonts
|
||||
@@ -113,6 +115,24 @@ apply_dotfiles() {
|
||||
echo
|
||||
}
|
||||
|
||||
validate_prerequisites() {
|
||||
missing_commands=""
|
||||
|
||||
for command_name in git zsh lsd tmux nvim rg; do
|
||||
if ! command_exists "$command_name"; then
|
||||
if [ -n "$missing_commands" ]; then
|
||||
missing_commands="$missing_commands, "
|
||||
fi
|
||||
missing_commands="${missing_commands}${command_name}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$missing_commands" ]; then
|
||||
error "required tools are missing: $missing_commands. Install them first via your package manager."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
remove_legacy_dotfile() {
|
||||
target_path=$1
|
||||
|
||||
@@ -162,6 +182,32 @@ link_dotfile() {
|
||||
echo "${GREEN}Linked $target_path -> $source_path${RESET}"
|
||||
}
|
||||
|
||||
ensure_directory() {
|
||||
target_path=$1
|
||||
|
||||
if [ -L "$target_path" ] || [ -f "$target_path" ]; then
|
||||
echo "${YELLOW}Removing existing $target_path${RESET}"
|
||||
rm -rf "$target_path"
|
||||
fi
|
||||
|
||||
mkdir -p "$target_path"
|
||||
}
|
||||
|
||||
install_kitty_config() {
|
||||
kitty_config_dir="$HOME/.config/kitty"
|
||||
|
||||
ensure_directory "$kitty_config_dir"
|
||||
link_dotfile "$DOTFILES_DIR/kitty/kitty.conf" "$kitty_config_dir/kitty.conf"
|
||||
link_dotfile "$DOTFILES_DIR/kitty/macos-launch-services-cmdline" "$kitty_config_dir/macos-launch-services-cmdline"
|
||||
|
||||
if is_studio_host; then
|
||||
link_dotfile "$DOTFILES_DIR/hosts/studio/kitty/quick-access-terminal.conf" "$kitty_config_dir/quick-access-terminal.conf"
|
||||
elif [ -L "$kitty_config_dir/quick-access-terminal.conf" ] || [ -e "$kitty_config_dir/quick-access-terminal.conf" ]; then
|
||||
echo "${YELLOW}Removing existing $kitty_config_dir/quick-access-terminal.conf${RESET}"
|
||||
rm -rf "$kitty_config_dir/quick-access-terminal.conf"
|
||||
fi
|
||||
}
|
||||
|
||||
install_karabiner_config() {
|
||||
mkdir -p "$HOME/.config/karabiner"
|
||||
link_dotfile "$DOTFILES_DIR/karabiner/karabiner.json" "$HOME/.config/karabiner/karabiner.json"
|
||||
@@ -171,7 +217,7 @@ install_karabiner_config() {
|
||||
install_kitty_icon() {
|
||||
icon_path="$DOTFILES_DIR/kitty/kitty.app.png"
|
||||
|
||||
if [ "$(uname -s)" != "Darwin" ]; then
|
||||
if ! is_macos; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -199,7 +245,7 @@ install_kitty_icon() {
|
||||
}
|
||||
|
||||
install_fonts() {
|
||||
if [ "$(uname -s)" != "Darwin" ]; then
|
||||
if ! is_macos; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -383,11 +429,7 @@ main() {
|
||||
done
|
||||
|
||||
setup_color
|
||||
|
||||
if ! command_exists zsh; then
|
||||
echo "${YELLOW}Zsh is not installed.${RESET} Please install zsh first."
|
||||
exit 1
|
||||
fi
|
||||
validate_prerequisites
|
||||
|
||||
setup_ohmyzsh
|
||||
setup_shell
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/Users/tracer/.config/dotfiles/karabiner/karabiner.json
|
||||
188
karabiner/karabiner.json
Normal file
188
karabiner/karabiner.json
Normal file
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"profiles": [
|
||||
{
|
||||
"complex_modifications": {
|
||||
"rules": [
|
||||
{
|
||||
"description": "codex: map cmd+v and shift+enter",
|
||||
"manipulators": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"bundle_identifiers": [
|
||||
"^com\\.openai\\.codex$"
|
||||
],
|
||||
"type": "frontmost_application_if"
|
||||
}
|
||||
],
|
||||
"from": {
|
||||
"key_code": "v",
|
||||
"modifiers": {
|
||||
"mandatory": ["command"],
|
||||
"optional": ["any"]
|
||||
}
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"key_code": "v",
|
||||
"modifiers": ["control"]
|
||||
}
|
||||
],
|
||||
"type": "basic"
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"bundle_identifiers": [
|
||||
"^com\\.openai\\.codex$"
|
||||
],
|
||||
"type": "frontmost_application_if"
|
||||
}
|
||||
],
|
||||
"from": {
|
||||
"key_code": "return_or_enter",
|
||||
"modifiers": {
|
||||
"mandatory": ["shift"],
|
||||
"optional": ["any"]
|
||||
}
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"key_code": "j",
|
||||
"modifiers": ["control"]
|
||||
}
|
||||
],
|
||||
"type": "basic"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "kitty: map cmd+enter to new OS window globally",
|
||||
"manipulators": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"bundle_identifiers": [
|
||||
"^net\\.kovidgoyal\\.kitty$"
|
||||
],
|
||||
"type": "frontmost_application_unless"
|
||||
}
|
||||
],
|
||||
"from": {
|
||||
"key_code": "return_or_enter",
|
||||
"modifiers": {
|
||||
"mandatory": ["command"]
|
||||
}
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"key_code": "vk_none"
|
||||
},
|
||||
{
|
||||
"shell_command": "/usr/bin/osascript -e 'tell application \"kitty\" to activate' -e 'tell application \"System Events\" to keystroke return using command down'"
|
||||
}
|
||||
],
|
||||
"type": "basic"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "kitty: map ctrl+enter to quick access terminal globally",
|
||||
"manipulators": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"bundle_identifiers": [
|
||||
"^net\\.kovidgoyal\\.kitty$"
|
||||
],
|
||||
"type": "frontmost_application_unless"
|
||||
}
|
||||
],
|
||||
"from": {
|
||||
"key_code": "return_or_enter",
|
||||
"modifiers": {
|
||||
"mandatory": ["control"]
|
||||
}
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"key_code": "vk_none"
|
||||
},
|
||||
{
|
||||
"shell_command": "/Applications/kitty.app/Contents/MacOS/kitten quick-access-terminal /Applications/kitty.app/Contents/MacOS/kitten run-shell --cwd \"$HOME\" >/tmp/kitty-quick-access.log 2>&1 < /dev/null &"
|
||||
}
|
||||
],
|
||||
"type": "basic"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "kitty: map cmd+left/right to ctrl+left/right",
|
||||
"manipulators": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"bundle_identifiers": [
|
||||
"^net\\.kovidgoyal\\.kitty$"
|
||||
],
|
||||
"type": "frontmost_application_if"
|
||||
}
|
||||
],
|
||||
"from": {
|
||||
"key_code": "left_arrow",
|
||||
"modifiers": {
|
||||
"mandatory": ["command"],
|
||||
"optional": ["any"]
|
||||
}
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"key_code": "left_arrow",
|
||||
"modifiers": ["control"]
|
||||
}
|
||||
],
|
||||
"type": "basic"
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"bundle_identifiers": [
|
||||
"^net\\.kovidgoyal\\.kitty$"
|
||||
],
|
||||
"type": "frontmost_application_if"
|
||||
}
|
||||
],
|
||||
"from": {
|
||||
"key_code": "right_arrow",
|
||||
"modifiers": {
|
||||
"mandatory": ["command"],
|
||||
"optional": ["any"]
|
||||
}
|
||||
},
|
||||
"to": [
|
||||
{
|
||||
"key_code": "right_arrow",
|
||||
"modifiers": ["control"]
|
||||
}
|
||||
],
|
||||
"type": "basic"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"fn_function_keys": [
|
||||
{
|
||||
"from": { "key_code": "f6" },
|
||||
"to": [{ "key_code": "f6" }]
|
||||
}
|
||||
],
|
||||
"name": "Default profile",
|
||||
"selected": true,
|
||||
"virtual_hid_keyboard": {
|
||||
"country_code": 0,
|
||||
"keyboard_type_v2": "ansi"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user