feat: export master Alacritty configuration to repo, update install.sh symlinks, and add Flatpak Alacritty sync

This commit is contained in:
Sho 2026-08-02 00:01:49 +09:00
parent b50244840e
commit 0b9b7a68eb
4 changed files with 126 additions and 42 deletions

40
alacritty/alacritty.toml Normal file
View File

@ -0,0 +1,40 @@
[general]
import = ["~/.config/alacritty/colors.toml"]
working_directory = "None"
live_config_reload = true
[env]
TERM = "xterm-256color"
WINIT_X11_SCALE_FACTOR = "1.0"
[window]
dimensions = { columns = 100, lines = 30 }
dynamic_padding = true
decorations = "Full"
opacity = 1.0
title = "Alacritty@CachyOS"
class = { instance = "Alacritty", general = "Alacritty" }
decorations_theme_variant = "Dark"
[scrolling]
history = 10000
multiplier = 3
[font]
normal = { family = "MonoLisa", style = "Regular" }
bold = { family = "MonoLisa", style = "Bold" }
italic = { family = "MonoLisa", style = "Italic" }
bold_italic = { family = "MonoLisa", style = "Bold Italic" }
size = 12.0
[selection]
semantic_escape_chars = ",│`|:\"' ()[]{}<> "
save_to_clipboard = true
[cursor]
style = { shape = "Underline", blinking = "Off" }
unfocused_hollow = true
thickness = 0.15
[mouse]
hide_when_typing = true

31
alacritty/colors.toml Normal file
View File

@ -0,0 +1,31 @@
[colors.primary]
background = "#22212c"
foreground = "#f8f8f2"
[colors.cursor]
text = "#22212c"
cursor = "#9580ff"
[colors.selection]
text = "#22212c"
background = "#9580ff"
[colors.normal]
black = "#22212c"
red = "#ff9580"
green = "#8aff80"
yellow = "#ffff80"
blue = "#9580ff"
magenta = "#ff80bf"
cyan = "#80ffea"
white = "#f8f8f2"
[colors.bright]
black = "#454158"
red = "#ff9580"
green = "#8aff80"
yellow = "#ffff80"
blue = "#9580ff"
magenta = "#ff80bf"
cyan = "#80ffea"
white = "#f8f8f2"

View File

@ -264,6 +264,13 @@ deploy_configs() {
ln -snf "${SCRIPT_DIR}/fastfetch" "${TARGET_CONFIG_DIR}/fastfetch" || cp -r "${SCRIPT_DIR}/fastfetch" "${TARGET_CONFIG_DIR}/fastfetch"
fi
# Alacritty Configuration (Symlinked to repo so quality of life updates apply automatically)
if [ -d "${SCRIPT_DIR}/alacritty" ]; then
info "Unlinking existing & linking Alacritty configuration..."
safe_unlink "${TARGET_CONFIG_DIR}/alacritty"
ln -snf "${SCRIPT_DIR}/alacritty" "${TARGET_CONFIG_DIR}/alacritty" || cp -r "${SCRIPT_DIR}/alacritty" "${TARGET_CONFIG_DIR}/alacritty"
fi
# Wallpapers Deployment
if [ -d "${SCRIPT_DIR}/quickshell/wallpapers" ]; then
info "Deploying default wallpapers to ~/Pictures/Wallpapers..."

View File

@ -137,10 +137,14 @@ def sync_gtk(bg, surface, current_line, fg, accent, is_dark):
def sync_alacritty(bg, surface, current_line, fg, accent, sub_accent):
import glob, os, re
alacritty_dir = os.path.expanduser('~/.config/alacritty')
os.makedirs(alacritty_dir, exist_ok=True)
colors_file = os.path.join(alacritty_dir, 'colors.toml')
toml_file = os.path.join(alacritty_dir, 'alacritty.toml')
alacritty_dirs = get_app_config_dirs(['alacritty', 'Alacritty'])
for fb in [
os.path.expanduser('~/.config/alacritty'),
os.path.expanduser('~/.var/app/io.github.alacritty.Alacritty/config/alacritty'),
os.path.expanduser('~/.var/app/org.alacritty.Alacritty/config/alacritty')
]:
if fb not in alacritty_dirs:
alacritty_dirs.append(fb)
colors_block = f"""[colors.primary]
background = "{bg}"
@ -174,50 +178,52 @@ magenta = "{sub_accent}"
cyan = "#80ffea"
white = "{fg}"
"""
try:
with open(colors_file, 'w', encoding='utf-8') as f:
f.write(colors_block)
f.flush()
os.fsync(f.fileno())
except Exception:
pass
if os.path.exists(toml_file):
for alacritty_dir in alacritty_dirs:
try:
with open(toml_file, 'r', encoding='utf-8') as f:
content = f.read()
os.makedirs(alacritty_dir, exist_ok=True)
colors_file = os.path.join(alacritty_dir, 'colors.toml')
toml_file = os.path.join(alacritty_dir, 'alacritty.toml')
lines = content.splitlines()
cleaned_lines = []
in_colors = False
for line in lines:
stripped = line.strip()
if stripped.startswith('[colors') or stripped.startswith('[[colors'):
in_colors = True
continue
elif in_colors and stripped.startswith('[') and not stripped.startswith('[colors') and not stripped.startswith('[[colors'):
in_colors = False
with open(colors_file, 'w', encoding='utf-8') as f:
f.write(colors_block)
f.flush()
os.fsync(f.fileno())
if not in_colors:
cleaned_lines.append(line)
if os.path.exists(toml_file):
with open(toml_file, 'r', encoding='utf-8') as f:
content = f.read()
content = '\n'.join(cleaned_lines)
lines = content.splitlines()
cleaned_lines = []
in_colors = False
for line in lines:
stripped = line.strip()
if stripped.startswith('[colors') or stripped.startswith('[[colors'):
in_colors = True
continue
elif in_colors and stripped.startswith('[') and not stripped.startswith('[colors') and not stripped.startswith('[[colors'):
in_colors = False
if 'colors.toml' not in content:
import_line = 'import = ["colors.toml"]\n'
if '[general]' in content:
content = content.replace('[general]', '[general]\n' + import_line)
else:
content = '[general]\n' + import_line + '\n' + content
if not in_colors:
cleaned_lines.append(line)
with open(toml_file, 'w', encoding='utf-8') as f:
f.write(content.strip() + '\n')
content = '\n'.join(cleaned_lines)
if 'colors.toml' not in content:
import_line = 'import = ["colors.toml"]\n'
if '[general]' in content:
content = content.replace('[general]', '[general]\n' + import_line)
else:
content = '[general]\n' + import_line + '\n' + content
with open(toml_file, 'w', encoding='utf-8') as f:
f.write(content.strip() + '\n')
else:
with open(toml_file, 'w', encoding='utf-8') as f:
f.write('[general]\nimport = ["colors.toml"]\nlive_config_reload = true\n')
except Exception:
pass
else:
try:
with open(toml_file, 'w', encoding='utf-8') as f:
f.write('[general]\nimport = ["colors.toml"]\nlive_config_reload = true\n')
except Exception:
pass