mirror of
https://github.com/aaddrick/claude-desktop-debian.git
synced 2026-05-17 08:36:35 +03:00
Splits the 2124-line build.sh into a 318-line orchestrator plus
16 topical modules, grouped so CODEOWNERS can assign per-subsystem
reviewers:
scripts/_common.sh shared shell utilities
scripts/setup/ host detection, deps, download
scripts/patches/ regex patches on minified JS
_common.sh extract_electron_variable etc.
app-asar.sh wrapper injection
titlebar.sh
tray.sh menu handler + icon selection
quick-window.sh
claude-code.sh
cowork.sh cowork linux patching (largest)
scripts/staging/ post-patch file staging
build.sh now sources each module in dependency order and retains
only run_packaging, cleanup_build, print_next_steps, and main.
All globals stay at the top of build.sh and are read by sourced
modules; each module's header documents which globals it reads and
mutates (implicit-contract documentation).
This is a pure-move refactor. Function bodies were copied verbatim
— verified by byte-identical diff of the function set vs the
pre-split build.sh (34 functions, all present with identical bodies).
Note: .github/workflows/shellcheck.yml may benefit from a '-x' flag
so shellcheck follows the new '# shellcheck source=' directives, but
that CI tweak is left as a separate concern.
Co-Authored-By: Claude <claude@anthropic.com>
79 lines
2.5 KiB
Bash
79 lines
2.5 KiB
Bash
#===============================================================================
|
|
# Icon processing: extract exe icons with wrestool/icotool, convert tray
|
|
# icons to 100% opaque PNG so they render on Linux panels.
|
|
#
|
|
# Sourced by: build.sh
|
|
# Sourced globals:
|
|
# claude_extract_dir, project_root, work_dir, electron_resources_dest
|
|
# Modifies globals: (none)
|
|
#===============================================================================
|
|
|
|
process_icons() {
|
|
section_header 'Icon Processing'
|
|
|
|
cd "$claude_extract_dir" || exit 1
|
|
local exe_path='lib/net45/claude.exe'
|
|
if [[ ! -f $exe_path ]]; then
|
|
echo "Cannot find claude.exe at expected path: $claude_extract_dir/$exe_path" >&2
|
|
cd "$project_root" || exit 1
|
|
exit 1
|
|
fi
|
|
|
|
echo "Extracting application icons from $exe_path..."
|
|
if ! wrestool -x -t 14 "$exe_path" -o claude.ico; then
|
|
echo 'Failed to extract icons from exe' >&2
|
|
cd "$project_root" || exit 1
|
|
exit 1
|
|
fi
|
|
|
|
if ! icotool -x claude.ico; then
|
|
echo 'Failed to convert icons' >&2
|
|
cd "$project_root" || exit 1
|
|
exit 1
|
|
fi
|
|
cp claude_*.png "$work_dir/" || exit 1
|
|
echo "Application icons extracted and copied to $work_dir"
|
|
|
|
cd "$project_root" || exit 1
|
|
|
|
# Process tray icons
|
|
local claude_locale_src="$claude_extract_dir/lib/net45/resources"
|
|
echo 'Copying and processing tray icon files for Linux...'
|
|
if [[ ! -d $claude_locale_src ]]; then
|
|
echo "Warning: Claude resources directory not found at $claude_locale_src"
|
|
section_footer 'Icon Processing'
|
|
return
|
|
fi
|
|
|
|
cp "$claude_locale_src/Tray"* "$electron_resources_dest/" 2>/dev/null || \
|
|
echo 'Warning: No tray icon files found'
|
|
|
|
# Find ImageMagick command
|
|
local magick_cmd=''
|
|
command -v magick &> /dev/null && magick_cmd='magick'
|
|
[[ -z $magick_cmd ]] && command -v convert &> /dev/null && magick_cmd='convert'
|
|
|
|
if [[ -z $magick_cmd ]]; then
|
|
echo 'Warning: ImageMagick not found - tray icons may appear invisible'
|
|
echo 'Tray icon files copied (unprocessed)'
|
|
section_footer 'Icon Processing'
|
|
return
|
|
fi
|
|
|
|
echo "Processing tray icons for Linux visibility (using $magick_cmd)..."
|
|
local icon_file icon_name
|
|
for icon_file in "$electron_resources_dest"/TrayIconTemplate*.png; do
|
|
[[ ! -f $icon_file ]] && continue
|
|
icon_name=$(basename "$icon_file")
|
|
if "$magick_cmd" "$icon_file" -channel A -fx 'a>0?1:0' +channel \
|
|
"PNG32:$icon_file" 2>/dev/null; then
|
|
echo " Processed $icon_name (100% opaque)"
|
|
else
|
|
echo " Failed to process $icon_name"
|
|
fi
|
|
done
|
|
echo 'Tray icon files copied and processed'
|
|
|
|
section_footer 'Icon Processing'
|
|
}
|