-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·99 lines (84 loc) · 2.69 KB
/
install.sh
File metadata and controls
executable file
·99 lines (84 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
# Set XDG defaults if not already set
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
# Check if OPENAI_API_KEY is set
if [ -z "$OPENAI_API_KEY" ]; then
echo "OpenAI API key not found."
echo "Please enter your OpenAI API key (starts with 'sk-'):"
read -r api_key
else
api_key="$OPENAI_API_KEY"
fi
if [ -z "$GEMINI_API_KEY" ]; then
echo "Optional: enter your Gemini API key (starts with 'AI'):"
read -r gemini_key
else
gemini_key="$GEMINI_API_KEY"
fi
if [ -z "$GROK_API_KEY" ]; then
echo "Optional: enter your Grok API key (starts with 'xai-'):"
read -r grok_key
else
grok_key="$GROK_API_KEY"
fi
if [ -z "$CLAUDE_API_KEY" ] && [ -z "$ANTHROPIC_API_KEY" ]; then
echo "Optional: enter your Claude API key (starts with 'sk-ant-'):"
read -r claude_key
else
# Prefer an explicitly set CLAUDE_API_KEY but fall back to ANTHROPIC_API_KEY.
claude_key="${CLAUDE_API_KEY:-$ANTHROPIC_API_KEY}"
fi
echo "Setting up ChatGTK desktop integration..."
# Get the absolute path to the current directory
INSTALL_DIR=$(pwd)
# Create a wrapper script that sets up the environment
echo "Creating launcher script..."
cat << EOF > chatgtk-launcher.sh
#!/bin/bash
EOF
if [ -n "$api_key" ]; then
echo "export OPENAI_API_KEY=\"${api_key}\"" >> chatgtk-launcher.sh
fi
if [ -n "$gemini_key" ]; then
echo "export GEMINI_API_KEY=\"${gemini_key}\"" >> chatgtk-launcher.sh
fi
if [ -n "$grok_key" ]; then
echo "export GROK_API_KEY=\"${grok_key}\"" >> chatgtk-launcher.sh
fi
if [ -n "$claude_key" ]; then
echo "export CLAUDE_API_KEY=\"${claude_key}\"" >> chatgtk-launcher.sh
echo "export ANTHROPIC_API_KEY=\"${claude_key}\"" >> chatgtk-launcher.sh
fi
cat << EOF >> chatgtk-launcher.sh
cd "${INSTALL_DIR}"
exec python3 src/ChatGTK.py
EOF
# Make wrapper executable
chmod +x chatgtk-launcher.sh
echo "Creating desktop entry..."
# Create desktop entry using the wrapper script
cat << EOF > chatgtk.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=ChatGTK
Comment=OpenAI Chat Client with GTK interface
Exec=${INSTALL_DIR}/chatgtk-launcher.sh
Icon=${INSTALL_DIR}/src/icon.png
Categories=Network;Chat;AI;
Terminal=false
StartupNotify=true
Keywords=chat;ai;gpt;openai;
EOF
echo "Making desktop entry executable..."
# Make it executable
chmod +x chatgtk.desktop
echo "Installing desktop entry..."
# Copy to local applications directory
mkdir -p "${XDG_DATA_HOME}/applications/"
mv chatgtk.desktop "${XDG_DATA_HOME}/applications/"
echo "Updating desktop database..."
# Update desktop database
update-desktop-database "${XDG_DATA_HOME}/applications/"
echo "Installation complete! You can now find ChatGTK in your applications menu."