diff --git a/scripts/debian/alacritty.toml b/scripts/debian/alacritty.toml new file mode 100644 index 0000000..3e928be --- /dev/null +++ b/scripts/debian/alacritty.toml @@ -0,0 +1,91 @@ +[font] + size = 11 + normal = { family = "SFMono Nerd Font" } + +[terminal] + osc52 = "CopyPaste" + +[window] +padding = { x = 8, y = 5 } +opacity = 0.97 +decorations = "None" + +[shell] + program = "/usr/bin/zsh" + +# Dracula theme for Alacritty +# https://draculatheme.com/alacritty +# +# Color palette +# https://spec.draculatheme.com +# +# Instructions +# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd + +[colors.primary] + +background = "#282a36" +foreground = "#f8f8f2" +bright_foreground = "#ffffff" + +[colors.cursor] + +text = "#282a36" +cursor = "#f8f8f2" + +[colors.vi_mode_cursor] + +text = "CellBackground" +cursor = "CellForeground" + +[colors.selection] + +text = "CellForeground" +background = "#44475a" + +[colors.normal] + +black = "#21222c" +red = "#ff5555" +green = "#50fa7b" +yellow = "#f1fa8c" +blue = "#bd93f9" +magenta = "#ff79c6" +cyan = "#8be9fd" +white = "#f8f8f2" + +[colors.bright] + +black = "#6272a4" +red = "#ff6e6e" +green = "#69ff94" +yellow = "#ffffa5" +blue = "#d6acff" +magenta = "#ff92df" +cyan = "#a4ffff" +white = "#ffffff" + +[colors.search.matches] + +foreground = "#44475a" +background = "#50fa7b" + +[colors.search.focused_match] + +foreground = "#44475a" +background = "#ffb86c" + +[colors.footer_bar] + +background = "#282a36" +foreground = "#f8f8f2" + +[colors.hints.start] + +foreground = "#282a36" +background = "#f1fa8c" + +[colors.hints.end] + +foreground = "#f1fa8c" +background = "#282a36" diff --git a/scripts/debian/install.sh b/scripts/debian/install.sh index a5b3046..b0c2d25 100755 --- a/scripts/debian/install.sh +++ b/scripts/debian/install.sh @@ -3,7 +3,8 @@ set -e set -x SCRIPT_DIR=$(dirname "$0") -ROOT_DIR=$(realpath "${SCRIPT_DIR}/../..") + +source "$SCRIPT_DIR/common.sh" # Initialize a flag optional_provided=false @@ -58,7 +59,7 @@ function setup_open_any_terminal() { if [ "$DESKTOP_SESSION" != "ubuntu" ]; then return fi - # to open from nautilus with wezterm + # to open from nautilus with default terminal # if /home/jorbik/.local/share/nautilus-python/extensions/nautilus_open_any_terminal.py does not exist if [ ! -f ~/.local/share/nautilus-python/extensions/nautilus_open_any_terminal.py ]; then cwd=$(pwd) @@ -69,13 +70,26 @@ function setup_open_any_terminal() { make make install schema # User install - gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal wezterm + gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal alacritty sudo apt install python3-nautilus -y - echo "To make the 'Open with Wezterm' work restart nautilus: 'nautilus -q'" + echo "To make the 'Open with ' work restart nautilus: 'nautilus -q'" cd "$cwd" fi } +function setup_trdop() { + cwd=$(pwd) + mkdir -p ~/.local/bin/ + cd ~/.local/bin/ + git clone https://github.com/noctuid/tdrop.git + echo "Add custom hotkey in Ubuntu to activate terminal with tdrop" + echo "Command is: '$HOME/.local/bin/tdrop/tdrop -mta -h 100% '" + echo "This will work work with nvidia drivers on the latest Ubuntu" + # installing tdrop dependencies + sudo apt install xdotool gawk -y + cd "$cwd" +} + function setup_wezterm() { curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list @@ -84,16 +98,57 @@ function setup_wezterm() { if [ "$DESKTOP_SESSION" == "ubuntu" ] && [[ ! -e "$HOME/.local/bin/tdrop/tdrop" ]]; then # ubuntu specific - set up tdrop for wezterm activation with hotkey - cwd=$(pwd) - mkdir -p ~/.local/bin/ - cd ~/.local/bin/ - git clone https://github.com/noctuid/tdrop.git - echo "Add custom hotkey in Ubuntu to activate wezterm with tdrop" - echo "Command is: '$HOME/.local/bin/tdrop/tdrop -mta -h 100% wezterm'" - echo "This will work work with nvidia drivers on the latest Ubuntu" - # installing tdrop dependencies - sudo apt install xdotool gawk -y - cd "$cwd" + setup_trdop + fi +} + +function setup_alacritty_source() { + sudo apt install cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3 gzip scdoc -y + # install from source + install_rust + rustup override set stable + rustup update stable + cd /tmp + rm -rf alacritty + git clone https://github.com/alacritty/alacritty.git + cd alacritty + + highest_tag=$(get_highest_tag_version) + git checkout "$highest_tag" + + cargo build --release + # terminfo + infocmp alacritty || sudo tic -xe alacritty,alacritty-direct extra/alacritty.info + # desktop entry + sudo cp target/release/alacritty /usr/local/bin # or anywhere else in $PATH + sudo cp extra/logo/alacritty-term.svg /usr/share/pixmaps/Alacritty.svg + sudo desktop-file-install extra/linux/Alacritty.desktop + sudo update-desktop-database + # manual page + sudo mkdir -p /usr/local/share/man/man1 + sudo mkdir -p /usr/local/share/man/man5 + scdoc < extra/man/alacritty.1.scd | gzip -c | sudo tee /usr/local/share/man/man1/alacritty.1.gz > /dev/null + scdoc < extra/man/alacritty-msg.1.scd | gzip -c | sudo tee /usr/local/share/man/man1/alacritty-msg.1.gz > /dev/null + scdoc < extra/man/alacritty.5.scd | gzip -c | sudo tee /usr/local/share/man/man5/alacritty.5.gz > /dev/null + scdoc < extra/man/alacritty-bindings.5.scd | gzip -c | sudo tee /usr/local/share/man/man5/alacritty-bindings.5.gz > /dev/null + # completion + mkdir -p ~/.zsh_functions + grep -qxF 'fpath+=~/.zsh_functions' "$HOME"/.zshrc || echo 'fpath+=~/.zsh_functions' >>"$HOME"/.zshrc + cp extra/completions/_alacritty ${ZDOTDIR:-~}/.zsh_functions/_alacritty +} + +function setup_alacritty() { + if ! [ -x "$(command -v alacritty)" ]; then + sudo apt install alacritty -y || setup_alacritty_source + fi + if [ "$DESKTOP_SESSION" == "ubuntu" ]; then + # ubuntu specific - set up tdrop for wezterm activation with hotkey + if [[ ! -e "$HOME/.local/bin/tdrop/tdrop" ]]; then + setup_trdop + fi + echo "Consider running these to set the default terminal" + echo "sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/alacritty 50" + echo "sudo update-alternatives --config x-terminal-emulator" fi } @@ -103,6 +158,7 @@ setup_sublimetext setup_wezterm setup_open_any_terminal sudo apt install copyq -y +setup_alacritty if [ "$DESKTOP_SESSION" == "ubuntu" ]; then # disable meta+number key bindings - it interferes with wezterm diff --git a/scripts/debian/install_min.sh b/scripts/debian/install_min.sh index a12f9c1..196421e 100755 --- a/scripts/debian/install_min.sh +++ b/scripts/debian/install_min.sh @@ -4,9 +4,7 @@ set -x SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) -function get_highest_tag_version() { - git tag | sort -V | tail -n 1 -} +source "$SCRIPT_DIR/common.sh" function command_exists() { command -v "$1" &>/dev/null @@ -127,14 +125,6 @@ function update_git() { fi } -function install_rust() { - if ! [ -x "$(command -v cargo)" ]; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - grep -qxF 'source "$HOME/.cargo/env"' $HOME/.zshrc || echo 'source "$HOME/.cargo/env"' >>$HOME/.zshrc - echo "Please source ~/.zshrc or ~/.bashrc" - fi -} - function install_rust_tree_sitter() { install_rust $HOME/.cargo/bin/cargo install tree-sitter-cli diff --git a/scripts/macos/alacritty.toml b/scripts/macos/alacritty.toml new file mode 100644 index 0000000..2787f6c --- /dev/null +++ b/scripts/macos/alacritty.toml @@ -0,0 +1,87 @@ +[font] + size = 13 + normal = { family = "Monaco Nerd Font" } + +[terminal] + osc52 = "CopyPaste" + +[window] +padding = { x = 8, y = 5 } +opacity = 0.97 + +# Dracula theme for Alacritty +# https://draculatheme.com/alacritty +# +# Color palette +# https://spec.draculatheme.com +# +# Instructions +# https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd + +[colors.primary] + +background = "#282a36" +foreground = "#f8f8f2" +bright_foreground = "#ffffff" + +[colors.cursor] + +text = "#282a36" +cursor = "#f8f8f2" + +[colors.vi_mode_cursor] + +text = "CellBackground" +cursor = "CellForeground" + +[colors.selection] + +text = "CellForeground" +background = "#44475a" + +[colors.normal] + +black = "#21222c" +red = "#ff5555" +green = "#50fa7b" +yellow = "#f1fa8c" +blue = "#bd93f9" +magenta = "#ff79c6" +cyan = "#8be9fd" +white = "#f8f8f2" + +[colors.bright] + +black = "#6272a4" +red = "#ff6e6e" +green = "#69ff94" +yellow = "#ffffa5" +blue = "#d6acff" +magenta = "#ff92df" +cyan = "#a4ffff" +white = "#ffffff" + +[colors.search.matches] + +foreground = "#44475a" +background = "#50fa7b" + +[colors.search.focused_match] + +foreground = "#44475a" +background = "#ffb86c" + +[colors.footer_bar] + +background = "#282a36" +foreground = "#f8f8f2" + +[colors.hints.start] + +foreground = "#282a36" +background = "#f1fa8c" + +[colors.hints.end] + +foreground = "#f1fa8c" +background = "#282a36" diff --git a/scripts/set_up_common.sh b/scripts/set_up_common.sh index 148596c..76a9cbe 100755 --- a/scripts/set_up_common.sh +++ b/scripts/set_up_common.sh @@ -2,6 +2,8 @@ set -e set -x +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) + if [ -d ~/.oh-my-zsh ]; then echo "oh-my-zsh is installed" else @@ -40,3 +42,17 @@ mkdir -p ~/.config/direnv echo '[global] load_dotenv = true strict_env = true' >"$HOME"/.config/direnv/direnv.toml + +alacritty_path="$HOME/.config/alacritty/alacritty.toml" +if [ ! -e "$alacritty_path" ]; then + mkdir -p ~/.config/alacritty + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + cp "${SCRIPT_DIR}/debian/alacritty.toml" "$alacritty_path" + elif [[ "$OSTYPE" == "darwin"* ]]; then + cp "${SCRIPT_DIR}/macos/alacritty.toml" "$alacritty_path" + else + echo "Unsupported OS" + exit 1 + fi + cp +fi