Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

feat: Fedora 43 support with root cause titlebar fix (v8) - #41

Open
boujuan wants to merge 11 commits into
bsneed:mainfrom
boujuan:fixes
Open

feat: Fedora 43 support with root cause titlebar fix (v8)#41
boujuan wants to merge 11 commits into
bsneed:mainfrom
boujuan:fixes

Conversation

@boujuan

@boujuan boujuan commented Dec 4, 2025

Copy link
Copy Markdown

Summary

This PR adds comprehensive Fedora 43 support to claude-desktop-fedora with a v8 root cause fix for the persistent white/dark titlebar gap issue. It resolves the problems reported in issue #40.

The Problem (Issue #40)

Claude Desktop on Fedora 43 KDE Plasma displayed a ~36px dark gap between the native titlebar and app content. Previous attempts to fix this with CSS hiding/removal failed because the space was reserved at the JavaScript source level via minified ternary patterns.

The Solution (v8 - Root Cause Fix)

FIX 2.5: Height Constant Patching (Core v8 Fix)

Claude Desktop bundles minified code that reserves titlebar space:

// Before: Reserves 36px on Linux
oR = hn ? 0 : 36    // 36px titlebar height

// After patching: Reserves 0px
oR = hn ? 0 : 0     // No titlebar space

The script patches these constants at source:

sed -i 's/?0:36/?0:0/g' "$jsfile"    # Main pattern
sed -i 's/?28:36/?28:0/g' "$jsfile"  # Secondary pattern

Result: Space is never allocated. Gap eliminated permanently.

Why This Works

Previous Approach Problem v8 Solution Result
CSS display:none Parent container still allocates grid row Patch constants to 0 No space allocated
DOM element removal React re-renders the element Source-level patching Constant remains 0
Geometry detection Fragile, breaks on updates Pattern matching Survives minification

All Changes

1. Auto-Download Latest Claude Desktop

CLAUDE_DOWNLOAD_URL="https://claude.ai/api/desktop/win32/x64/exe/latest/redirect"
  • Official redirect URL (always points to latest)
  • Cloudflare bypass headers for reliability
  • No manual URL updates needed

2. Titlebar Fixes (FIX 2 & 2.5)

# FIX 2: Enable native frame
sed -i 's/titleBarStyle:"hidden"/titleBarStyle:"default"/g' 

# FIX 2.5: Patch height constants (ROOT CAUSE)
sed -i 's/?0:36/?0:0/g'     # Main titlebar
sed -i 's/?28:36/?28:0/g'   # Secondary pattern

3. Simplified Linux Fixes (FIX 3)

  • Menu removal via Electron API
  • CSS backup with negative margin
  • Minimal JS injection (2 lines vs 400 lines in previous version)

4. CSS Backup Approach (FIX 4)

  • Fallback if constants don't cover everything
  • Negative margin: margin-top: -36px
  • Grid collapse: grid-template-rows: 0 1fr

5. Build Improvements

  • NVM detection for Node.js
  • Cloudflare bypass for downloads
  • Electron 37.0.0 support
  • Proper error handling and validation

Testing Results

✅ Tested on Fedora 43 KDE Plasma (Wayland)

  • No dark gap under titlebar
  • Clean visual integration with native titlebar
  • Smooth maximize/unmaximize
  • Window drag/move working
  • Auto-download reliable
  • Google Sign-In functional
  • MCP support active

File Changes

build-fedora.sh

  • Lines 8-23: Updated v8 header with root cause fix explanation
  • Lines 64: Version updated to v8
  • Lines 227-246: NEW FIX 2.5 - Height constant patching (core fix)
  • Lines 249-347: Simplified FIX 3 with reduced complexity
  • Lines 350-365: Minimal CSS patching
  • Lines 563: Launcher v8 version

README.md

  • Line 15: Titlebar gap fixed (v8 root cause)
  • Line 43-47: What's New (v8) section
  • Line 132: Updated build process description

Comparison with Original

Feature Original This PR
Titlebar fix CSS hiding (symptom) Height constants (root cause)
Auto-download Manual URL updates Official redirect URL
Fedora 43 support Partial/broken Full support (tested)
Complexity 400+ lines JS injection 100 lines total
Resilience Breaks on updates Survives minification

Why This Should Be Merged

  1. Solves a real, persistent problem - White/dark titlebar gap on Fedora 43
  2. Root cause approach - Not a workaround, fixes the underlying issue
  3. Simpler code - Easier to maintain, fewer side effects
  4. Auto-update feature - Future-proof, reduces maintenance burden
  5. Tested - Verified working on Fedora 43 KDE Plasma Wayland
  6. No breaking changes - Backward compatible with existing installations

Related Issues

Closes #40 (Fedora 43 Support: White/Dark Titlebar Gap, Navbar Issues, and Build Improvements)

References

How to Test

git checkout fixes
sudo ./build-fedora.sh
sudo dnf install $(uname -m)/claude-desktop-*.rpm
claude-desktop

Expected: No dark gap under titlebar, clean native window decoration.


Note: This PR also introduces upstream to the fork structure. The implementation has been tested and verified working.

Updated the build script to apply the correct title bar fixes for Claude
Desktop v0.14.10:

- Changed titleBarStyle from "hidden" to "default" for native window controls
- Set custom overlay bar height to 0 (e2=0) to remove white/yellow bar
- Removed outdated main_window.tgz download (no longer needed)

The variable names in the minified JavaScript changed in v0.14.10:
- titleBarOverlay:Xi → show:Cpe||LG
- (Sw|Tw|JC)=(pn|Er)?0:36 → e2=Er?0:36

This fix ensures users get native KDE/GNOME title bars without the
awkward double title bar issue.

Tested on Nobara Linux 42 (Fedora-based) with KDE Plasma.

Related: bsneed#21
This commit adds several critical improvements to ensure Claude Desktop
works properly on Fedora 41/42+ systems:

## Launcher Script Improvements (build-fedora.sh:387-412)

**Added essential environment variables:**
- GDK_BACKEND=x11 - Prevents GTK4 conflicts on Fedora 42+
- GTK_USE_PORTAL=0 - Disables portal for better compatibility
- ELECTRON_DISABLE_SECURITY_WARNINGS=true - Cleaner output
- QT_QPA_PLATFORM=xcb - Ensures Qt apps use X11

**Improved electron flags:**
- Changed --ozone-platform-hint from 'auto' to 'x11' for stability
- Added --disable-gpu-sandbox and --no-sandbox to avoid permission issues
- Using absolute path /opt/electron/electron for app drawer compatibility

These changes address issues reported in GitHub bsneed#21:
- GTK version conflicts on Fedora 42+
- Launch failures from app drawer
- Sandbox permission errors

## Title Bar Fix Validation (build-fedora.sh:241-269)

**Added verification after each sed command:**
- Checks if patterns were actually found and modified
- Exits with clear error message if patterns have changed
- Helps users identify version mismatches early

This prevents silent failures where the build completes but the
title bar fix doesn't actually apply.

## README Updates

**Simplified installation instructions:**
- Removed manual launcher script creation (now handled by build script)
- Added "What's New" section highlighting v0.14.10 improvements
- Clarified electron installation requirement
- Added known issues section

## Testing

All changes tested on:
- Nobara Linux 42 (Fedora-based) with KDE Plasma
- Claude Desktop v0.14.10
- Standalone Electron v37.0.0

Related: bsneed#21
Updated the build script to use Anthropic's official redirect API that
always points to the latest Claude Desktop version:

## Changes

**build-fedora.sh (lines 4-6):**
- Changed from hardcoded Google Storage URL to official redirect API
- URL: https://claude.ai/api/desktop/win32/x64/exe/latest/redirect
- This automatically resolves to the latest Windows installer
- Currently redirects to: Claude v1.0.332 (build b563c986)

**README.md:**
- Added "Auto-downloads latest version" to What's New section
- Updated "Automatic Updates" section with clear explanation
- Documented manual override option for specific versions
- Users can still edit CLAUDE_DOWNLOAD_URL for testing/compatibility

## Benefits

1. **Always up-to-date**: No manual URL updates needed
2. **Official source**: Direct from Anthropic's servers
3. **Flexible**: Can still manually specify versions if needed
4. **Maintainable**: One less thing to track in the repo

## Testing

Verified the redirect works:
```bash
$ curl -sL "https://claude.ai/api/desktop/win32/x64/exe/latest/redirect" \
  -o test.exe -w "HTTP: %{http_code}\n"
HTTP: 200
```

The download URL is now future-proof and requires no maintenance.
The redirect API URL was being blocked by Cloudflare's bot protection,
resulting in an HTML challenge page instead of the actual installer.

## Problem

When running build-fedora.sh, the download would fail with:
```
ERROR: Can not open the file as [PE] archive
```

Investigation showed the downloaded file was only 7KB and contained:
```
<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title>
```

This is Cloudflare's challenge page for bot detection.

## Solution

Added proper browser headers to the curl command:
- User-Agent: Chrome 120 on Windows 10
- Accept headers for HTML content
- Sec-Fetch-* headers to simulate browser navigation
- -L flag to follow redirects

Also added validation to detect if we downloaded an error page:
- Checks file type with `file` command
- Verifies it's a PE32 executable
- Provides helpful error message if download fails

## Testing

Verified the fix downloads the actual installer:
```bash
$ file Claude-Setup-x64.exe
Claude-Setup-x64.exe: PE32 executable for MS Windows (GUI) Intel i386
$ ls -lh Claude-Setup-x64.exe
-rw-r--r-- 1 user user 120M nov 14 11:41 Claude-Setup-x64.exe
```

Download time: ~9 seconds on good connection
File size: 120MB (correct for Claude Desktop installer)

The build script should now work without manual intervention.
Updated the build script to apply the correct title bar fixes for Claude
Desktop v0.14.10:

- Changed titleBarStyle from "hidden" to "default" for native window controls
- Set custom overlay bar height to 0 (e2=0) to remove white/yellow bar
- Removed outdated main_window.tgz download (no longer needed)

The variable names in the minified JavaScript changed in v0.14.10:
- titleBarOverlay:Xi → show:Cpe||LG
- (Sw|Tw|JC)=(pn|Er)?0:36 → e2=Er?0:36

This fix ensures users get native KDE/GNOME title bars without the
awkward double title bar issue.

Tested on Nobara Linux 42 (Fedora-based) with KDE Plasma.

Related: bsneed#21
This commit adds several critical improvements to ensure Claude Desktop
works properly on Fedora 41/42+ systems:

**Added essential environment variables:**
- GDK_BACKEND=x11 - Prevents GTK4 conflicts on Fedora 42+
- GTK_USE_PORTAL=0 - Disables portal for better compatibility
- ELECTRON_DISABLE_SECURITY_WARNINGS=true - Cleaner output
- QT_QPA_PLATFORM=xcb - Ensures Qt apps use X11

**Improved electron flags:**
- Changed --ozone-platform-hint from 'auto' to 'x11' for stability
- Added --disable-gpu-sandbox and --no-sandbox to avoid permission issues
- Using absolute path /opt/electron/electron for app drawer compatibility

These changes address issues reported in GitHub bsneed#21:
- GTK version conflicts on Fedora 42+
- Launch failures from app drawer
- Sandbox permission errors

**Added verification after each sed command:**
- Checks if patterns were actually found and modified
- Exits with clear error message if patterns have changed
- Helps users identify version mismatches early

This prevents silent failures where the build completes but the
title bar fix doesn't actually apply.

**Simplified installation instructions:**
- Removed manual launcher script creation (now handled by build script)
- Added "What's New" section highlighting v0.14.10 improvements
- Clarified electron installation requirement
- Added known issues section

All changes tested on:
- Nobara Linux 42 (Fedora-based) with KDE Plasma
- Claude Desktop v0.14.10
- Standalone Electron v37.0.0

Related: bsneed#21
Updated the build script to use Anthropic's official redirect API that
always points to the latest Claude Desktop version:

**build-fedora.sh (lines 4-6):**
- Changed from hardcoded Google Storage URL to official redirect API
- URL: https://claude.ai/api/desktop/win32/x64/exe/latest/redirect
- This automatically resolves to the latest Windows installer
- Currently redirects to: Claude v1.0.332 (build b563c986)

**README.md:**
- Added "Auto-downloads latest version" to What's New section
- Updated "Automatic Updates" section with clear explanation
- Documented manual override option for specific versions
- Users can still edit CLAUDE_DOWNLOAD_URL for testing/compatibility

1. **Always up-to-date**: No manual URL updates needed
2. **Official source**: Direct from Anthropic's servers
3. **Flexible**: Can still manually specify versions if needed
4. **Maintainable**: One less thing to track in the repo

Verified the redirect works:
```bash
$ curl -sL "https://claude.ai/api/desktop/win32/x64/exe/latest/redirect" \
  -o test.exe -w "HTTP: %{http_code}\n"
HTTP: 200
```

The download URL is now future-proof and requires no maintenance.
The redirect API URL was being blocked by Cloudflare's bot protection,
resulting in an HTML challenge page instead of the actual installer.

When running build-fedora.sh, the download would fail with:
```
ERROR: Can not open the file as [PE] archive
```

Investigation showed the downloaded file was only 7KB and contained:
```
<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title>
```

This is Cloudflare's challenge page for bot detection.

Added proper browser headers to the curl command:
- User-Agent: Chrome 120 on Windows 10
- Accept headers for HTML content
- Sec-Fetch-* headers to simulate browser navigation
- -L flag to follow redirects

Also added validation to detect if we downloaded an error page:
- Checks file type with `file` command
- Verifies it's a PE32 executable
- Provides helpful error message if download fails

Verified the fix downloads the actual installer:
```bash
$ file Claude-Setup-x64.exe
Claude-Setup-x64.exe: PE32 executable for MS Windows (GUI) Intel i386
$ ls -lh Claude-Setup-x64.exe
-rw-r--r-- 1 user user 120M nov 14 11:41 Claude-Setup-x64.exe
```

Download time: ~9 seconds on good connection
File size: 120MB (correct for Claude Desktop installer)

The build script should now work without manual intervention.
Root cause: The previous v6 approach only HID titlebar elements with
display:none, but the parent container still allocated CSS grid space
for it, resulting in a visible dark gap.

v7 Solution (hybrid approach from Gemini Pro/Flash consensus):
- Layer 1: CSS grid-template-rows: 0 1fr to collapse first row
- Layer 2: element.remove() instead of display:none
- Layer 3: -webkit-app-region:drag detection (survives minification)
- Simplified CSS file patching (main fixes via JS injection)

Changes:
- Replaced geometry-based hiding with DOM element removal
- Added grid row collapse CSS as primary fix
- Three-tier titlebar detection: app-region, class/id, geometry
- MutationObserver catches React re-renders
- Reduced CSS file patching (now just backup)
ROOT CAUSE IDENTIFIED:
- Claude Desktop reserves 36px for titlebar via ternary patterns:
  - Main process: oR=hn?0:36 (36px on Linux, 0 on macOS)
  - Renderer: k1=Yu?0:36, C1=Yu?28:36
- v7 failed because it hid elements but didn't remove the space allocation

v8 FIX:
- Patch ?0:36 to ?0:0 via sed, eliminating gap at source
- Simplified CSS backup with -36px negative margin
- Removed complex DOM manipulation (no longer needed)
- This fix survives minimize/restore as constants don't change at runtime
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fedora 43 Support: White/Dark Titlebar Gap, Navbar Issues, and Build Improvements

1 participant