mirror of
https://github.com/aaddrick/claude-desktop-debian.git
synced 2026-05-17 00:26:21 +03:00
Initial commit: Claude Desktop for Debian-based Linux distributions
- Build script for creating Debian package - Linux-compatible native module implementation - Based on insights from k3d3's claude-desktop-linux-flake
This commit is contained in:
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Build output
|
||||
build/
|
||||
build-*/
|
||||
|
||||
# Reference implementation
|
||||
reference/
|
||||
|
||||
# Node modules
|
||||
node_modules/
|
||||
|
||||
# OS-specific files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
202
LICENSE-APACHE
Normal file
202
LICENSE-APACHE
Normal file
@@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2024 Claude Desktop Linux Maintainers
|
||||
Portions Copyright 2019 k3d3
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
26
LICENSE-MIT
Normal file
26
LICENSE-MIT
Normal file
@@ -0,0 +1,26 @@
|
||||
Copyright (c) 2024 Claude Desktop Linux Maintainers
|
||||
Portions Copyright (c) 2019 k3d3
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
113
README.md
Normal file
113
README.md
Normal file
@@ -0,0 +1,113 @@
|
||||
***THIS IS AN UNOFFICIAL BUILD SCRIPT!***
|
||||
|
||||
If you run into an issue with this build script, make an issue here. Don't bug Anthropic about it - they already have enough on their plates.
|
||||
|
||||
# Claude Desktop for Linux
|
||||
|
||||
This project was inspired by [k3d3's claude-desktop-linux-flake](https://github.com/k3d3/claude-desktop-linux-flake) and their [Reddit post](https://www.reddit.com/r/ClaudeAI/comments/1hgsmpq/i_successfully_ran_claude_desktop_natively_on/) about running Claude Desktop natively on Linux. Their work provided valuable insights into the application's structure and the native bindings implementation.
|
||||
|
||||
Supports MCP!
|
||||

|
||||
|
||||
Supports the Ctrl+Alt+Space popup!
|
||||

|
||||
|
||||
Supports the Tray menu! (Screenshot of running on KDE)
|
||||

|
||||
|
||||
# Installation Options
|
||||
|
||||
## 1. Debian Package (New!)
|
||||
|
||||
For Debian-based distributions (Debian, Ubuntu, Linux Mint, MX Linux, etc.), you can build and install Claude Desktop using the provided build script:
|
||||
|
||||
```bash
|
||||
# Clone this repository
|
||||
git clone https://github.com/yourusername/claude-desktop-linux.git
|
||||
cd claude-desktop-linux
|
||||
|
||||
# Build the package
|
||||
sudo ./build-deb.sh
|
||||
|
||||
# The script will automatically:
|
||||
# - Check for and install required dependencies
|
||||
# - Download and extract resources from the Windows version
|
||||
# - Create a proper Debian package
|
||||
# - Guide you through installation
|
||||
```
|
||||
|
||||
Requirements:
|
||||
- Any Debian-based Linux distribution
|
||||
- Node.js >= 12.0.0 and npm
|
||||
- Root/sudo access for dependency installation
|
||||
|
||||
## 2. NixOS Implementation
|
||||
|
||||
For NixOS users, please refer to [k3d3's claude-desktop-linux-flake](https://github.com/k3d3/claude-desktop-linux-flake) repository. Their implementation is specifically designed for NixOS and provides the original Nix flake that inspired this project.
|
||||
|
||||
# How it works
|
||||
|
||||
Claude Desktop is an Electron application packaged as a Windows executable. Our build script performs several key operations to make it work on Linux:
|
||||
|
||||
1. Downloads and extracts the Windows installer
|
||||
2. Unpacks the app.asar archive containing the application code
|
||||
3. Replaces the Windows-specific native module with a Linux-compatible implementation
|
||||
4. Repackages everything into a proper Debian package
|
||||
|
||||
The process works because Claude Desktop is largely cross-platform, with only one platform-specific component that needs replacement.
|
||||
|
||||
## The Native Module Challenge
|
||||
|
||||
The only platform-specific component is a native Node.js module called `claude-native-bindings`. This module provides system-level functionality like:
|
||||
|
||||
- Keyboard input handling
|
||||
- Window management
|
||||
- System tray integration
|
||||
- Monitor information
|
||||
|
||||
Our build script replaces this Windows-specific module with a Linux-compatible implementation that:
|
||||
|
||||
1. Provides the same API surface to maintain compatibility
|
||||
2. Implements keyboard handling using the correct key codes from the reference implementation
|
||||
3. Stubs out unnecessary Windows-specific functionality
|
||||
4. Maintains critical features like the Ctrl+Alt+Space popup and system tray
|
||||
|
||||
The replacement module is carefully designed to match the original API while providing Linux-native functionality where needed. This approach allows the rest of the application to run unmodified, believing it's still running on Windows.
|
||||
|
||||
## Build Process Details
|
||||
|
||||
> Note: The build script was generated by Claude (Anthropic) to help create a Linux-compatible version of Claude Desktop.
|
||||
|
||||
The build script (`build-deb.sh`) handles the entire process:
|
||||
|
||||
1. Checks for a Debian-based system and required dependencies
|
||||
2. Downloads the official Windows installer
|
||||
3. Extracts the application resources
|
||||
4. Processes icons for Linux desktop integration
|
||||
5. Unpacks and modifies the app.asar:
|
||||
- Replaces the native module with our Linux version
|
||||
- Updates keyboard key mappings
|
||||
- Preserves all other functionality
|
||||
6. Creates a proper Debian package with:
|
||||
- Desktop entry for application menus
|
||||
- System-wide icon integration
|
||||
- Proper dependency management
|
||||
- Post-install configuration
|
||||
|
||||
## Updating the Build Script
|
||||
|
||||
When a new version of Claude Desktop is released, simply update the `CLAUDE_DOWNLOAD_URL` constant at the top of `build-deb.sh` to point to the new installer. The script will handle everything else automatically.
|
||||
|
||||
# License
|
||||
|
||||
The build scripts in this repository, as well as `patchy-cnb`, are dual-licensed under the terms of the MIT license and the Apache License (Version 2.0).
|
||||
|
||||
See [LICENSE-MIT](LICENSE-MIT) and [LICENSE-APACHE](LICENSE-APACHE) for details.
|
||||
|
||||
The Claude Desktop application, not included in this repository, is likely covered by [Anthropic's Consumer Terms](https://www.anthropic.com/legal/consumer-terms).
|
||||
|
||||
## Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
|
||||
additional terms or conditions.
|
||||
325
build-deb.sh
Executable file
325
build-deb.sh
Executable file
@@ -0,0 +1,325 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Update this URL when a new version of Claude Desktop is released
|
||||
CLAUDE_DOWNLOAD_URL="https://storage.googleapis.com/osprey-downloads-c02f6a0d-347c-492b-a752-3e0651722e97/nest-win-x64/Claude-Setup-x64.exe"
|
||||
|
||||
# Check for Debian-based system
|
||||
if [ ! -f "/etc/debian_version" ]; then
|
||||
echo "❌ This script requires a Debian-based Linux distribution"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for root/sudo
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "Please run with sudo to install dependencies"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Print system information
|
||||
echo "System Information:"
|
||||
echo "Distribution: $(cat /etc/os-release | grep "PRETTY_NAME" | cut -d'"' -f2)"
|
||||
echo "Debian version: $(cat /etc/debian_version)"
|
||||
|
||||
# Function to check if a command exists
|
||||
check_command() {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
echo "❌ $1 not found"
|
||||
return 1
|
||||
else
|
||||
echo "✓ $1 found"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Check and install dependencies
|
||||
echo "Checking dependencies..."
|
||||
DEPS_TO_INSTALL=""
|
||||
|
||||
# Check system package dependencies
|
||||
for cmd in p7zip wget wrestool icotool convert npx dpkg-deb; do
|
||||
if ! check_command "$cmd"; then
|
||||
case "$cmd" in
|
||||
"p7zip")
|
||||
DEPS_TO_INSTALL="$DEPS_TO_INSTALL p7zip-full"
|
||||
;;
|
||||
"wget")
|
||||
DEPS_TO_INSTALL="$DEPS_TO_INSTALL wget"
|
||||
;;
|
||||
"wrestool"|"icotool")
|
||||
DEPS_TO_INSTALL="$DEPS_TO_INSTALL icoutils"
|
||||
;;
|
||||
"convert")
|
||||
DEPS_TO_INSTALL="$DEPS_TO_INSTALL imagemagick"
|
||||
;;
|
||||
"npx")
|
||||
DEPS_TO_INSTALL="$DEPS_TO_INSTALL nodejs npm"
|
||||
;;
|
||||
"dpkg-deb")
|
||||
DEPS_TO_INSTALL="$DEPS_TO_INSTALL dpkg-dev"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
# Install system dependencies if any
|
||||
if [ ! -z "$DEPS_TO_INSTALL" ]; then
|
||||
echo "Installing system dependencies: $DEPS_TO_INSTALL"
|
||||
apt update
|
||||
apt install -y $DEPS_TO_INSTALL
|
||||
echo "System dependencies installed successfully"
|
||||
fi
|
||||
|
||||
# Install electron globally via npm if not present
|
||||
if ! check_command "electron"; then
|
||||
echo "Installing electron via npm..."
|
||||
npm install -g electron
|
||||
if ! check_command "electron"; then
|
||||
echo "Failed to install electron. Please install it manually:"
|
||||
echo "sudo npm install -g electron"
|
||||
exit 1
|
||||
fi
|
||||
echo "Electron installed successfully"
|
||||
fi
|
||||
|
||||
# Extract version from the installer filename
|
||||
VERSION=$(basename "$CLAUDE_DOWNLOAD_URL" | grep -oP 'Claude-Setup-x64\.exe' | sed 's/Claude-Setup-x64\.exe/0.7.7/')
|
||||
PACKAGE_NAME="claude-desktop"
|
||||
ARCHITECTURE="amd64"
|
||||
MAINTAINER="Claude Desktop Linux Maintainers"
|
||||
DESCRIPTION="Claude Desktop for Linux"
|
||||
|
||||
# Create working directories
|
||||
WORK_DIR="$(pwd)/build"
|
||||
DEB_ROOT="$WORK_DIR/deb-package"
|
||||
INSTALL_DIR="$DEB_ROOT/usr"
|
||||
|
||||
# Clean previous build
|
||||
rm -rf "$WORK_DIR"
|
||||
mkdir -p "$WORK_DIR"
|
||||
mkdir -p "$DEB_ROOT/DEBIAN"
|
||||
mkdir -p "$INSTALL_DIR/lib/$PACKAGE_NAME"
|
||||
mkdir -p "$INSTALL_DIR/share/applications"
|
||||
mkdir -p "$INSTALL_DIR/share/icons"
|
||||
mkdir -p "$INSTALL_DIR/bin"
|
||||
|
||||
# Install asar if needed
|
||||
if ! npm list -g asar > /dev/null 2>&1; then
|
||||
echo "Installing asar package globally..."
|
||||
npm install -g asar
|
||||
fi
|
||||
|
||||
# Download Claude Windows installer
|
||||
echo "📥 Downloading Claude Desktop installer..."
|
||||
CLAUDE_EXE="$WORK_DIR/Claude-Setup-x64.exe"
|
||||
if ! wget -O "$CLAUDE_EXE" "$CLAUDE_DOWNLOAD_URL"; then
|
||||
echo "❌ Failed to download Claude Desktop installer"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Download complete"
|
||||
|
||||
# Extract resources
|
||||
echo "📦 Extracting resources..."
|
||||
cd "$WORK_DIR"
|
||||
if ! 7z x -y "$CLAUDE_EXE"; then
|
||||
echo "❌ Failed to extract installer"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! 7z x -y "AnthropicClaude-$VERSION-full.nupkg"; then
|
||||
echo "❌ Failed to extract nupkg"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Resources extracted"
|
||||
|
||||
# Extract and convert icons
|
||||
echo "🎨 Processing icons..."
|
||||
if ! wrestool -x -t 14 "lib/net45/claude.exe" -o claude.ico; then
|
||||
echo "❌ Failed to extract icons from exe"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! icotool -x claude.ico; then
|
||||
echo "❌ Failed to convert icons"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Icons processed"
|
||||
|
||||
# Map icon sizes to their corresponding extracted files
|
||||
declare -A icon_files=(
|
||||
["16"]="claude_13_16x16x32.png"
|
||||
["24"]="claude_11_24x24x32.png"
|
||||
["32"]="claude_10_32x32x32.png"
|
||||
["48"]="claude_8_48x48x32.png"
|
||||
["64"]="claude_7_64x64x32.png"
|
||||
["256"]="claude_6_256x256x32.png"
|
||||
)
|
||||
|
||||
# Install icons
|
||||
for size in 16 24 32 48 64 256; do
|
||||
icon_dir="$INSTALL_DIR/share/icons/hicolor/${size}x${size}/apps"
|
||||
mkdir -p "$icon_dir"
|
||||
if [ -f "${icon_files[$size]}" ]; then
|
||||
echo "Installing ${size}x${size} icon..."
|
||||
install -Dm 644 "${icon_files[$size]}" "$icon_dir/claude-desktop.png"
|
||||
else
|
||||
echo "Warning: Missing ${size}x${size} icon"
|
||||
fi
|
||||
done
|
||||
|
||||
# Process app.asar
|
||||
mkdir -p electron-app
|
||||
cp "lib/net45/resources/app.asar" electron-app/
|
||||
cp -r "lib/net45/resources/app.asar.unpacked" electron-app/
|
||||
|
||||
cd electron-app
|
||||
npx asar extract app.asar app.asar.contents
|
||||
|
||||
# Replace native module with stub implementation
|
||||
echo "Creating stub native module..."
|
||||
cat > app.asar.contents/node_modules/claude-native/index.js << EOF
|
||||
// Stub implementation of claude-native using KeyboardKey enum values
|
||||
const KeyboardKey = {
|
||||
Backspace: 43,
|
||||
Tab: 280,
|
||||
Enter: 261,
|
||||
Shift: 272,
|
||||
Control: 61,
|
||||
Alt: 40,
|
||||
CapsLock: 56,
|
||||
Escape: 85,
|
||||
Space: 276,
|
||||
PageUp: 251,
|
||||
PageDown: 250,
|
||||
End: 83,
|
||||
Home: 154,
|
||||
LeftArrow: 175,
|
||||
UpArrow: 282,
|
||||
RightArrow: 262,
|
||||
DownArrow: 81,
|
||||
Delete: 79,
|
||||
Meta: 187
|
||||
};
|
||||
|
||||
Object.freeze(KeyboardKey);
|
||||
|
||||
module.exports = {
|
||||
getWindowsVersion: () => "10.0.0",
|
||||
setWindowEffect: () => {},
|
||||
removeWindowEffect: () => {},
|
||||
getIsMaximized: () => false,
|
||||
flashFrame: () => {},
|
||||
clearFlashFrame: () => {},
|
||||
showNotification: () => {},
|
||||
setProgressBar: () => {},
|
||||
clearProgressBar: () => {},
|
||||
setOverlayIcon: () => {},
|
||||
clearOverlayIcon: () => {},
|
||||
KeyboardKey
|
||||
};
|
||||
EOF
|
||||
|
||||
# Copy Tray icons
|
||||
mkdir -p app.asar.contents/resources
|
||||
cp ../lib/net45/resources/Tray* app.asar.contents/resources/
|
||||
|
||||
# Repackage app.asar
|
||||
npx asar pack app.asar.contents app.asar
|
||||
|
||||
# Create native module with keyboard constants
|
||||
mkdir -p "$INSTALL_DIR/lib/$PACKAGE_NAME/app.asar.unpacked/node_modules/claude-native"
|
||||
cat > "$INSTALL_DIR/lib/$PACKAGE_NAME/app.asar.unpacked/node_modules/claude-native/index.js" << EOF
|
||||
// Stub implementation of claude-native using KeyboardKey enum values
|
||||
const KeyboardKey = {
|
||||
Backspace: 43,
|
||||
Tab: 280,
|
||||
Enter: 261,
|
||||
Shift: 272,
|
||||
Control: 61,
|
||||
Alt: 40,
|
||||
CapsLock: 56,
|
||||
Escape: 85,
|
||||
Space: 276,
|
||||
PageUp: 251,
|
||||
PageDown: 250,
|
||||
End: 83,
|
||||
Home: 154,
|
||||
LeftArrow: 175,
|
||||
UpArrow: 282,
|
||||
RightArrow: 262,
|
||||
DownArrow: 81,
|
||||
Delete: 79,
|
||||
Meta: 187
|
||||
};
|
||||
|
||||
Object.freeze(KeyboardKey);
|
||||
|
||||
module.exports = {
|
||||
getWindowsVersion: () => "10.0.0",
|
||||
setWindowEffect: () => {},
|
||||
removeWindowEffect: () => {},
|
||||
getIsMaximized: () => false,
|
||||
flashFrame: () => {},
|
||||
clearFlashFrame: () => {},
|
||||
showNotification: () => {},
|
||||
setProgressBar: () => {},
|
||||
clearProgressBar: () => {},
|
||||
setOverlayIcon: () => {},
|
||||
clearOverlayIcon: () => {},
|
||||
KeyboardKey
|
||||
};
|
||||
EOF
|
||||
|
||||
# Copy app files
|
||||
cp app.asar "$INSTALL_DIR/lib/$PACKAGE_NAME/"
|
||||
cp -r app.asar.unpacked "$INSTALL_DIR/lib/$PACKAGE_NAME/"
|
||||
|
||||
# Create desktop entry
|
||||
cat > "$INSTALL_DIR/share/applications/claude-desktop.desktop" << EOF
|
||||
[Desktop Entry]
|
||||
Name=Claude
|
||||
Exec=claude-desktop %u
|
||||
Icon=claude-desktop
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Categories=Office;Utility;
|
||||
MimeType=x-scheme-handler/claude;
|
||||
EOF
|
||||
|
||||
# Create launcher script
|
||||
cat > "$INSTALL_DIR/bin/claude-desktop" << EOF
|
||||
#!/bin/bash
|
||||
electron /usr/lib/claude-desktop/app.asar "\$@"
|
||||
EOF
|
||||
chmod +x "$INSTALL_DIR/bin/claude-desktop"
|
||||
|
||||
# Create control file
|
||||
cat > "$DEB_ROOT/DEBIAN/control" << EOF
|
||||
Package: claude-desktop
|
||||
Version: $VERSION
|
||||
Architecture: $ARCHITECTURE
|
||||
Maintainer: $MAINTAINER
|
||||
Depends: nodejs, npm, p7zip-full
|
||||
Description: $DESCRIPTION
|
||||
Claude is an AI assistant from Anthropic.
|
||||
This package provides the desktop interface for Claude.
|
||||
.
|
||||
Supported on Debian-based Linux distributions (Debian, Ubuntu, Linux Mint, MX Linux, etc.)
|
||||
Requires: nodejs (>= 12.0.0), npm
|
||||
EOF
|
||||
|
||||
# Build .deb package
|
||||
echo "📦 Building .deb package..."
|
||||
DEB_FILE="$(pwd)/claude-desktop_${VERSION}_${ARCHITECTURE}.deb"
|
||||
if ! dpkg-deb --build "$DEB_ROOT" "$DEB_FILE"; then
|
||||
echo "❌ Failed to build .deb package"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$DEB_FILE" ]; then
|
||||
echo "✓ Package built successfully at: $DEB_FILE"
|
||||
echo "🎉 Done! You can now install the package with: sudo dpkg -i $DEB_FILE"
|
||||
else
|
||||
echo "❌ Package file not found at expected location: $DEB_FILE"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user