Fix HUD launcher host handling
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. The Kitty HUD display pin lives in a host-specific file and is only installed on the host named `studio`.
|
||||
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 launcher reads the host-specific display pin from the dotfiles repo when running on the host named `studio`.
|
||||
|
||||

|
||||
[original image, 1.8M](https://24unix.net/build/images/Settings/user_screen_original.png)
|
||||
|
||||
40
install.sh
40
install.sh
@@ -53,18 +53,6 @@ is_macos() {
|
||||
[ "$(uname -s)" = "Darwin" ]
|
||||
}
|
||||
|
||||
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() {
|
||||
echo ${RED}"Error: $@"${RESET} >&2
|
||||
}
|
||||
@@ -101,7 +89,7 @@ apply_dotfiles() {
|
||||
link_dotfile "$DOTFILES_DIR/.gitconfig" "$HOME/.gitconfig"
|
||||
link_dotfile "$DOTFILES_DIR/.p10k.zsh" "$HOME/.p10k.zsh"
|
||||
mkdir -p "$HOME/.config"
|
||||
install_kitty_config
|
||||
link_dotfile "$DOTFILES_DIR/kitty" "$HOME/.config/kitty"
|
||||
link_dotfile "$DOTFILES_DIR/nvim" "$HOME/.config/nvim"
|
||||
link_dotfile "$DOTFILES_DIR/tmux" "$HOME/.config/tmux"
|
||||
if is_macos; then
|
||||
@@ -182,32 +170,6 @@ 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"
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
"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 &"
|
||||
"shell_command": "$HOME/.config/kitty/launch-quick-access-terminal.sh >/tmp/kitty-quick-access.log 2>&1 < /dev/null &"
|
||||
}
|
||||
],
|
||||
"type": "basic"
|
||||
@@ -123,7 +123,7 @@
|
||||
"conditions": [
|
||||
{
|
||||
"bundle_identifiers": [
|
||||
"^net\\.kovidgoyal\\.kitty$"
|
||||
"^net\\.kovidgoyal\\.kitty(-quick-access)?$"
|
||||
],
|
||||
"type": "frontmost_application_if"
|
||||
}
|
||||
@@ -147,7 +147,7 @@
|
||||
"conditions": [
|
||||
{
|
||||
"bundle_identifiers": [
|
||||
"^net\\.kovidgoyal\\.kitty$"
|
||||
"^net\\.kovidgoyal\\.kitty(-quick-access)?$"
|
||||
],
|
||||
"type": "frontmost_application_if"
|
||||
}
|
||||
|
||||
18
kitty/launch-quick-access-terminal.sh
Executable file
18
kitty/launch-quick-access-terminal.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
|
||||
dotfiles_dir=$(CDPATH= cd -- "$script_dir/.." && pwd -P)
|
||||
host_name=$(scutil --get LocalHostName 2>/dev/null || hostname -s 2>/dev/null || hostname)
|
||||
|
||||
kitty_kitten=/Applications/kitty.app/Contents/MacOS/kitten
|
||||
studio_config=$dotfiles_dir/hosts/studio/kitty/quick-access-terminal.conf
|
||||
|
||||
if [ "$host_name" = "studio" ] && [ -f "$studio_config" ]; then
|
||||
exec "$kitty_kitten" quick-access-terminal --config "$studio_config" \
|
||||
"$kitty_kitten" run-shell --cwd "$HOME"
|
||||
fi
|
||||
|
||||
exec "$kitty_kitten" quick-access-terminal \
|
||||
"$kitty_kitten" run-shell --cwd "$HOME"
|
||||
Reference in New Issue
Block a user