Skip to content

Add Linux GTK head project#255

Merged
PureWeen merged 9 commits intomainfrom
feature/linux-gtk-head
Mar 5, 2026
Merged

Add Linux GTK head project#255
PureWeen merged 9 commits intomainfrom
feature/linux-gtk-head

Conversation

@Redth
Copy link
Copy Markdown
Collaborator

@Redth Redth commented Mar 2, 2026

Adds a Linux/GTK app head for PolyPilot using Platform.Maui.Linux.Gtk4.

Changes

  • New GTK project (PolyPilot.Gtk/) — shares all components/services from main project via <Compile Include> links
  • Platform detectionPlatformHelper recognizes Linux as a desktop platform
  • Package updates — all NuGet packages updated to latest (GTK4 0.5.1, MauiDevFlow 0.12.1, SDK 0.1.26, Markdig 1.0.0, MauiVersion 10.0.41)
  • MauiDevFlow — CLI updated to 0.12.1, skill files refreshed
  • GTK-specific services — stub NotificationManagerService and QrScannerService for Linux
  • CommunityToolkit.Maui — added for speech-to-text interface compatibility
  • CSS fix — settings page scroll clipping workaround for GTK WebKit

Tested

  • Builds and runs on Linux (Parallels ARM64 Ubuntu)
  • MauiDevFlow agent connects, Blazor WebView renders full UI
  • Session restore and Copilot server connection working

@Redth Redth marked this pull request as ready for review March 2, 2026 16:09
@StephaneDelcroix
Copy link
Copy Markdown
Collaborator

I see what you're doing here

@PureWeen
Copy link
Copy Markdown
Owner

PureWeen commented Mar 2, 2026

🤯

Copy link
Copy Markdown
Collaborator

@StephaneDelcroix StephaneDelcroix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Multi-model consensus review (5 models)

Findings

🔴 CRITICAL -- build.yml -- Missing with: key on Upload Linux AppImage step (5/5 models)
name:, path:, retention-days: are direct children of uses: instead of nested under with:. Step will fail.

🔴 CRITICAL -- build.yml -- Duplicate if: key on create-release job (5/5 models)
Two consecutive if: lines. Invalid YAML.

🟡 MODERATE -- PolyPilot.Gtk/MauiProgram.cs -- IDemoService not registered (3/5 models)
Demo mode will throw InvalidOperationException at runtime.

🟡 MODERATE -- NotificationManagerService.cs -- Sync block in async method + process leak (3/5 models)
WaitForExit(3000) blocks thread. Process.Start() return never disposed.

Action: ⚠️ Request changes

  1. Fix missing with: on upload step
  2. Remove duplicate if:
  3. Register IDemoService
  4. Fix blocking WaitForExit and process leak

@Redth
Copy link
Copy Markdown
Collaborator Author

Redth commented Mar 3, 2026

Thanks for the review! Verified each finding against the code:

1. Missing with: on Upload Linux AppImage — False positive. The with: key is present at line 602. All upload steps have correct YAML structure.

2. Duplicate if: on create-release — False positive. Only one if: at line 637. YAML parses clean.

3. IDemoService not registered — False positive. CopilotService's public constructor (line 179-181) does new DemoService() inline — it's never resolved from DI. The internal constructor accepting IDemoService is only used by unit tests.

4. Process leak in SendNotificationAsync — ✅ Valid, fixed in f43fcc2. Added using to dispose the process handle after firing.

@Redth Redth force-pushed the feature/linux-gtk-head branch from f43fcc2 to 8ad8c81 Compare March 3, 2026 15:12
@Redth Redth requested a review from StephaneDelcroix March 3, 2026 17:01
Copy link
Copy Markdown
Owner

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Squad — Consensus Report (5-model dispatch, 2+ agreement filter)

CI Status: ⚠️ No CI checks ran

🟡 MODERATE — create-release hard-gates on publish-linux (3/5 models)

.github/workflows/build.yml — Adding publish-linux to needs: [notarize-maccatalyst, publish-windows, publish-android, publish-linux] means any Linux CI failure blocks all platform releases. Since Linux GTK is experimental, it should not gate Mac/Windows/Android releases. Fix: either remove publish-linux from needs: or add continue-on-error: true to the Linux job.

🟡 MODERATE — Wrong workload for Linux GTK build (3/5 models)

.github/workflows/build.yml (publish-linux) — dotnet workload install maui-android is wrong for a Linux/GTK build. All other jobs use maui; only the Android job needs maui-android. The GTK project targets net10.0 with UseMaui=true. Fix: dotnet workload install maui.

🟢 MINOR — NotificationManagerService.InitializeAsync blocks calling thread (2/5 models)

PolyPilot.Gtk/Services/NotificationManagerService.cs:29proc?.WaitForExit(3000) is synchronous inside an async method. Should use await Task.Run(...) or WaitForExitAsync.

🟢 MINOR — CSS scroll overrides apply globally, not just GTK (2/5 models)

PolyPilot/wwwroot/app.css.content.settings-content-active override (overflow-y: auto !important) applies on all platforms, not just Linux. Could subtly change scroll on Mac/Windows.

✅ Confirmed Good

  • PlatformHelper.cs #else logic correctly classifies Linux as desktop
  • CopilotService.cs return info; fix is correct (method returns Task<AgentSessionInfo>)
  • GTK project structure and <Compile Include> links follow existing patterns
  • IDemoService — NOT a DI issue (public constructor chains to new DemoService() internally)

Recommended Action: ⚠️ Request changes

Fix the two CI issues before merge: wrong workload + release gate dependency.

Redth and others added 8 commits March 4, 2026 19:07
Add a new app head project for running PolyPilot natively on Linux
using Platform.Maui.Linux.Gtk4 (0.1.0-preview.1). The GTK head shares
all code, Razor components, and wwwroot assets from the main PolyPilot
project via Compile/RazorComponent/Content Include links.

Key pieces:
- Program.cs: GtkMauiApplication entry point with WebKit init and
  MauiDevFlow agent wiring
- MauiProgram.cs: GTK-specific MAUI builder with BlazorWebView handler
  registration and Gtk4 essentials
- Services/: Linux stub implementations for QrScannerService and
  NotificationManagerService
- Post-build target copies _framework Blazor assets and generates
  unscoped CSS bundle for GTK WebKit compatibility

Also updates:
- PolyPilot.slnx: add PolyPilot.Gtk project
- dotnet-tools.json: bump maui-devflow CLI to 0.8.1
- README.md: add Linux build/run instructions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PlatformHelper.IsDesktop only checked MACCATALYST and WINDOWS
preprocessor directives, causing Linux GTK builds to fall into the
false branch. This hid all desktop UI sections (Transport Mode,
Persistent Server, DevTunnel, etc.) and limited the app to Remote
mode only.

Add a runtime OperatingSystem fallback in the #else branch so any
non-mobile platform (including Linux) is correctly detected as
desktop. Also set a reasonable default window size (1400x900) on
Linux since the GTK default is too small for the desktop layout.

Update PlatformHelperTests to reflect that the test host (Linux)
now correctly reports IsDesktop=true.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The settings page used a nested scroll container (.settings-page with
overflow-y: auto inside .content with overflow: hidden) which caused
content to be unreachable on the GTK4 WebKit WebView.

Fix by:
- Changing .settings-page to overflow-y: visible / min-height: 100%
  so it sizes to its content instead of clipping
- Adding .settings-content-active class to article.content when the
  settings route is active, enabling overflow-y: auto at that level
- Resetting scroll position on settings page init and cleanup

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update MauiDevFlow CLI, NuGet packages, and skill to 0.12.1
- Update Platform.Maui.Linux.Gtk4 packages to 0.5.1
- Update GitHub.Copilot.SDK to 0.1.26, Markdig to 1.0.0
- Update MauiVersion to 10.0.41 in GTK head
- Add CommunityToolkit.Maui for speech-to-text support
- Register missing services (TutorialService, UsageStatsService, ISpeechToText)
- Pin sqlite-net-pcl and SQLitePCLRaw versions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build .deb, AppImage, and Flatpak artifacts for both arm64 and x64
using a matrix strategy with native runners. Follows the same pattern
as MAUI.Sherpa's publish-linux job.

- Uses ubuntu-latest (x64) and ubuntu-24.04-arm (arm64) runners
- Installs GTK4/WebKit deps, Flatpak SDK
- Publishes self-contained with CreateAppImage/CreateDeb/CreateFlatpak
- Uploads tar.gz, .deb, .AppImage, .flatpak as separate artifacts
- Updates create-release to include all Linux artifacts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the stub NotificationManagerService with a real implementation
that uses notify-send (libnotify) for desktop notifications. Checks
for notify-send availability on init and sends notifications with
--app-name=PolyPilot.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add using to Process.Start() in SendNotificationAsync so the process
handle is disposed after firing the notification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-error

- Fix publish-linux workload: maui-android → maui (GTK needs full workload)
- Make NotificationManagerService.InitializeAsync truly async via Task.Run
- Scope GTK CSS scroll overrides to body[data-platform='linux']
- Add PlatformHelper.PlatformName and set data-platform attribute on body
- Add continue-on-error on Linux artifact downloads in create-release

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Redth Redth force-pushed the feature/linux-gtk-head branch from 8ad8c81 to 3f96695 Compare March 5, 2026 00:11
@Redth
Copy link
Copy Markdown
Collaborator Author

Redth commented Mar 5, 2026

Addressed all 4 review findings from the latest review:

  1. Workload fix — Changed maui-androidmaui in the publish-linux job. The GTK project uses UseMaui=true which needs the full MAUI workload, not just the Android-specific one.

  2. Release gate — Removed publish-linux from create-release's needs: so Linux failures don't block releases. Added continue-on-error: true on all Linux artifact download steps so they gracefully skip if Linux didn't build.

  3. Async WaitForExit — Wrapped the synchronous Process.Start() + WaitForExit(3000) in InitializeAsync with Task.Run() so it's truly async and doesn't block the calling thread.

  4. CSS scoping — Scoped the GTK scroll overrides to body[data-platform="linux"] so they only apply on Linux. Added PlatformHelper.PlatformName property and set the data-platform attribute on the body element during first render in MainLayout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Redth
Copy link
Copy Markdown
Collaborator Author

Redth commented Mar 5, 2026

Reverted the workload thing - AI is wrong, we need maui-android only since the other ones can't install on linux

@PureWeen PureWeen merged commit c00f55b into main Mar 5, 2026
@PureWeen PureWeen deleted the feature/linux-gtk-head branch March 5, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants