From 0b9b7a68eb658bbab8b7af10ed4408c6aa336d7c Mon Sep 17 00:00:00 2001 From: Sho Date: Sun, 2 Aug 2026 00:01:49 +0900 Subject: [PATCH] feat: export master Alacritty configuration to repo, update install.sh symlinks, and add Flatpak Alacritty sync --- alacritty/alacritty.toml | 40 +++++++++++ alacritty/colors.toml | 31 ++++++++ install.sh | 7 ++ quickshell/services/python/theme_sync.py | 90 +++++++++++++----------- 4 files changed, 126 insertions(+), 42 deletions(-) create mode 100644 alacritty/alacritty.toml create mode 100644 alacritty/colors.toml diff --git a/alacritty/alacritty.toml b/alacritty/alacritty.toml new file mode 100644 index 0000000..d34851d --- /dev/null +++ b/alacritty/alacritty.toml @@ -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 diff --git a/alacritty/colors.toml b/alacritty/colors.toml new file mode 100644 index 0000000..849b46b --- /dev/null +++ b/alacritty/colors.toml @@ -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" diff --git a/install.sh b/install.sh index 7c9cfd9..af8b17f 100755 --- a/install.sh +++ b/install.sh @@ -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..." diff --git a/quickshell/services/python/theme_sync.py b/quickshell/services/python/theme_sync.py index c12c6de..91f07d9 100644 --- a/quickshell/services/python/theme_sync.py +++ b/quickshell/services/python/theme_sync.py @@ -137,11 +137,15 @@ 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}" foreground = "{fg}" @@ -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() - - 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 + 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') - if not in_colors: - cleaned_lines.append(line) - - content = '\n'.join(cleaned_lines) + with open(colors_file, 'w', encoding='utf-8') as f: + f.write(colors_block) + f.flush() + os.fsync(f.fileno()) - 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 os.path.exists(toml_file): + with open(toml_file, 'r', encoding='utf-8') as f: + content = f.read() - with open(toml_file, 'w', encoding='utf-8') as f: - f.write(content.strip() + '\n') + 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 not in_colors: + cleaned_lines.append(line) + + 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