Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
* eol=lf
*.bat eol=crlf
*.ps1 eol=crlf
*.ps2 eol=crlf
*.sh eol=lf
*.command eol=lf
*.png binary
*.zip binary
*.tgz binary
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ eclipse-target/
generated/
node_modules

# Generated GUI assets (created at runtime, not to be committed)
gui/scripts/windows/ideasy-gui.ico

# Package Files #
*.jar
*.war
Expand Down
122 changes: 122 additions & 0 deletions gui/scripts/linux/create-shortcuts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/bin/bash

# IDEasy GUI Shortcut Creator for Linux
# Creates .desktop files for easy GUI launching from the Application Menu and Desktop
# Supports: GNOME, KDE, XFCE, and other freedesktop-compatible environments

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LAUNCHER_SCRIPT="$SCRIPT_DIR/launch-gui.sh"
ICON_PATH="$SCRIPT_DIR/../../src/main/resources/com/devonfw/ide/gui/assets/devonfw.png"

# Set error handling - exit on error but allow catching specific errors
set -o pipefail

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

function print_error() {
echo -e "${RED}Error: $1${NC}" >&2
}

function print_success() {
echo -e "${GREEN}✓ $1${NC}"
}

function print_info() {
echo -e "${YELLOW}ℹ $1${NC}"
}

# Verify launcher script exists and is executable
if [ ! -f "$LAUNCHER_SCRIPT" ]; then
print_error "Launcher script not found: $LAUNCHER_SCRIPT"
exit 1
fi

chmod +x "$LAUNCHER_SCRIPT"

# Resolve icon: use bundled devonfw.png if available, otherwise fall back to system theme
if [ -f "$ICON_PATH" ]; then
ICON="$(cd "$(dirname "$ICON_PATH")" && pwd)/$(basename "$ICON_PATH")"
else
ICON="application-x-executable"
fi

# Create Desktop Entry (.desktop file)
function create_desktop_entry() {
local target_dir="$1"
local desktop_file="$target_dir/ideasy-gui.desktop"

if ! mkdir -p "$target_dir" 2>/dev/null; then
print_error "Failed to create directory: $target_dir"
return 1
fi

if ! cat > "$desktop_file" <<EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=IDEasy GUI
Comment=Launch IDEasy Integrated Development Environment GUI
Exec=$LAUNCHER_SCRIPT
Icon=$ICON
Terminal=false
Categories=Development;IDE;
StartupNotify=true
EOF
then
print_error "Failed to write: $desktop_file"
return 1
fi

# Make it executable (required for some desktop environments)
if ! chmod +x "$desktop_file" 2>/dev/null; then
print_error "Failed to make executable: $desktop_file"
return 1
fi

print_success "Created: $desktop_file"
return 0
}

# Create application menu entry
APPLICATIONS_DIR="$HOME/.local/share/applications"
if ! create_desktop_entry "$APPLICATIONS_DIR"; then
print_info "Note: Could not create application menu entry (may require additional permissions)"
else
# Refresh the application menu database so the entry appears immediately
update-desktop-database "$APPLICATIONS_DIR" 2>/dev/null || true
print_info "Launch from: Application Menu or Launcher"
fi

# Determine desktop directory via XDG standard (respects custom Desktop locations).
# On systems where xdg-user-dirs was never configured (e.g. minimal WM setups),
# xdg-user-dir falls back to printing $HOME itself — guard against that so we
# don't drop a loose .desktop file directly into the user's home directory.
DESKTOP_DIR=$(xdg-user-dir DESKTOP 2>/dev/null || echo "$HOME/Desktop")
DESKTOP_DIR="${DESKTOP_DIR%/}"
if [ -z "$DESKTOP_DIR" ] || [ "$DESKTOP_DIR" = "$HOME" ]; then
DESKTOP_DIR="$HOME/Desktop"
fi
if [ -d "$DESKTOP_DIR" ]; then
if ! create_desktop_entry "$DESKTOP_DIR"; then
print_info "Note: Desktop entry creation requires write permissions"
else
# GNOME 3.28+: mark desktop file as trusted so it can be launched by double-click
gio set "$DESKTOP_DIR/ideasy-gui.desktop" "metadata::trusted" true 2>/dev/null || true
print_info "Launch from: Desktop"
fi
else
print_info "Desktop directory not found (Desktop feature may not be available)"
fi

echo ""
print_success "IDEasy GUI shortcuts ready!"
echo ""
echo "Usage:"
echo " • Open your Application Menu and search for 'IDEasy GUI'"
echo " • Or double-click the shortcut on your Desktop"
echo " • First launch may take longer as Maven downloads dependencies"
echo ""
45 changes: 45 additions & 0 deletions gui/scripts/linux/launch-gui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# IDEasy GUI Launcher for Linux
# This script launches the IDEasy GUI using the native 'ide gui' command
# The GUI runs in the background, the script exits immediately

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
LOG_FILE="$HOME/.ideasy-gui.log"

# When launched from an application menu (Terminal=false), there is no console to
# show errors on. Redirect everything to a log file from the start so failures
# (e.g. 'ide' missing from the launcher's PATH) are diagnosable after the fact
exec >> "$LOG_FILE" 2>&1
echo "---- $(date) ----"

function notify_error() {
command -v notify-send &> /dev/null && notify-send -i dialog-error "IDEasy GUI" "$1"
}

if [ ! -f "$PROJECT_ROOT/pom.xml" ]; then
echo "Error: IDEasy project root not found at $PROJECT_ROOT"
echo "Please ensure this script is located in: IDEasy/gui/scripts/linux/"
notify_error "Project root not found at $PROJECT_ROOT"
exit 1
fi

# 'ide' is a shell function defined in $IDE_ROOT/_ide/installation/functions and
# sourced by ~/.bashrc / ~/.zshrc — those only get sourced in interactive shells.
# Application launchers (Terminal=false) start a plain, non-interactive shell, so
# 'ide' is invisible there even though it works fine from a terminal. Route through
# an interactive bash so the function gets sourced regardless of launch context.
if ! bash -ic "command -v ide" &> /dev/null; then
echo "Error: IDEasy is not installed or not in PATH"
echo "Please install IDEasy first: https://github.com/devonfw/IDEasy#setup"
notify_error "'ide' command not found (see $LOG_FILE)"
exit 1
fi

cd "$PROJECT_ROOT"

# Launch IDE GUI in background and exit immediately
bash -ic "ide gui" &

exit 0
121 changes: 121 additions & 0 deletions gui/scripts/macos/create-shortcuts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/bin/bash

# IDEasy GUI Shortcut Creator for macOS
# Creates shortcuts for easy GUI launching from Finder
# Supports creating: Applications folder alias and Desktop alias

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LAUNCHER_SCRIPT="$SCRIPT_DIR/launch-gui.command"

# Set error handling - exit on error but allow catching specific errors
set -o pipefail

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

function print_error() {
echo -e "${RED}Error: $1${NC}" >&2
}

function print_success() {
echo -e "${GREEN}✓ $1${NC}"
}

function print_info() {
echo -e "${YELLOW}ℹ $1${NC}"
}

# Verify launcher script exists and is executable
if [ ! -f "$LAUNCHER_SCRIPT" ]; then
print_error "Launcher script not found: $LAUNCHER_SCRIPT"
exit 1
fi

chmod +x "$LAUNCHER_SCRIPT"

# Create an alias/shortcut using osascript (AppleScript)
# Falls back to a symlink if Finder is not running or AppleScript fails
function create_alias() {
local source="$1"
local target_dir="$2"
local target_name="$3"

if [ ! -f "$source" ]; then
print_error "Source file not found: $source"
return 1
fi

if ! mkdir -p "$target_dir" 2>/dev/null; then
print_error "Failed to create directory: $target_dir"
return 1
fi

# Properly escape paths for AppleScript
local escaped_source="$(printf '%s\n' "$source" | sed 's/\\/\\\\/g; s/"/\\"/g')"
local escaped_target_dir="$(printf '%s\n' "$target_dir" | sed 's/\\/\\\\/g; s/"/\\"/g')"
local escaped_target_name="$(printf '%s\n' "$target_name" | sed 's/\\/\\\\/g; s/"/\\"/g')"

local output
output=$(osascript 2>&1 <<EOF
tell application "Finder"
try
make alias file to POSIX file "$escaped_source" at folder "$escaped_target_dir" with properties {name:"$escaped_target_name"}
return "success"
on error errMsg
error errMsg
end try
end tell
EOF
)

local exit_code=$?
if [ $exit_code -eq 0 ] && [ "$output" = "success" ]; then
print_success "Created shortcut: $target_dir/$target_name"
return 0
fi

# Fallback: create a symlink if AppleScript failed (e.g. Finder not running in CI/server)
# Keep the .command extension so Finder recognises it as a runnable shell script
print_info "AppleScript unavailable, falling back to symlink..."
if ln -sf "$source" "$target_dir/$target_name.command" 2>/dev/null; then
print_success "Created symlink: $target_dir/$target_name.command"
return 0
fi

print_error "Failed to create shortcut: $target_dir/$target_name"
[ -n "$output" ] && print_error "Reason: $output"
return 1
}

# Create Applications alias
APPS_DIR="$HOME/Applications"
if ! create_alias "$LAUNCHER_SCRIPT" "$APPS_DIR" "IDEasy GUI"; then
print_info "Note: Could not create Applications shortcut (may require additional permissions)"
else
print_info "Launch from: Applications > IDEasy GUI"
fi

# Create Desktop alias
DESKTOP_DIR="$HOME/Desktop"
if create_alias "$LAUNCHER_SCRIPT" "$DESKTOP_DIR" "IDEasy GUI"; then
print_info "Launch from: Desktop"
else
print_info "Note: Desktop shortcut creation requires manual steps"
print_info "You can manually create a shortcut by:"
print_info "1. Open Finder"
print_info "2. Go to $SCRIPT_DIR"
print_info "3. Right-click 'launch-gui.command' → Make Alias"
print_info "4. Drag alias to Desktop or Applications"
fi

echo ""
print_success "IDEasy GUI shortcuts ready!"
echo ""
echo "Usage:"
echo " • Open Finder and go to Applications"
echo " • Double-click 'IDEasy GUI' to launch"
echo " • Or double-click the Desktop shortcut"
echo ""
34 changes: 34 additions & 0 deletions gui/scripts/macos/launch-gui.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# IDEasy GUI Launcher for macOS
# This script launches the IDEasy GUI using the native 'ide gui' command
# The GUI runs in the background, the script exits immediately

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"

if [ ! -f "$PROJECT_ROOT/pom.xml" ]; then
echo "Error: IDEasy project root not found at $PROJECT_ROOT"
echo "Please ensure this script is located in: IDEasy/gui/scripts/macos/"
read -p "Press Enter to close..."
exit 1
fi

if ! command -v ide &> /dev/null; then
echo ""
echo "Error: IDEasy is not installed"
echo ""
echo "Please install IDEasy first:"
echo "https://github.com/devonfw/IDEasy#setup"
echo ""
read -p "Press Enter to close..."
exit 1
fi

cd "$PROJECT_ROOT"

# Launch IDE GUI in background and exit immediately
LOG_FILE="$HOME/.ideasy-gui.log"
ide gui >> "$LOG_FILE" 2>&1 &

exit 0
Loading
Loading