« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 3204 ms

feat: Linux platform (GTK 4) by triniwiz · Pull Request #11620 · NativeScript/NativeScript

Source: https://github.com/NativeScript/NativeScript/pull/11620

Repository navigation

feat: Linux platform (GTK 4) - #11620


Draft
triniwiz wants to merge 33 commits into feat/windows from feat/linux
Draft

feat: Linux platform (GTK 4) #11620 triniwiz wants to merge 33 commits into feat/windows from feat/linux

Conversation

triniwiz commented Nov 7, 2026 · edited Loading



Copy link Copy Markdown
Member

Adds support for the new Linux runtime (GTK 4).

Part of #27

triniwiz added 14 commits November 6, 2026 19:56 feat(linux): GTK 4 platform d5c257c
Adds a linux platform to @nativescript/core and @nativescript/webpack,
running on the NativeScript Linux runtime (C APIs from metadata).

- webpack: linux platform, __LINUX__ / global.isLinux, CommonJS output
- core: isLinux, LinuxApplication, LinuxNativeWindow (GtkWindow)
- views: core's own measure/layout pass (as on iOS); containers are
  GtkFixed with a JS custom layout manager placing children at the
  computed frames, leaf widgets measured with gtk_widget_measure
- styling through per-widget GTK CSS; Pango markup for formatted text
- Label, Button, Page, Frame, ActionBar, layouts, file system (GIO),
  http (runtime fetch), image source (GdkTexture), settings, device,
  screen, connectivity; remaining widgets are placeholders for now
- types-minimal: generated GTK / GLib / Pango / Cairo typings
feat(linux): app id, window icon and window options 0600d56
The program name is the app id from nativescript.config, so desktops match
windows to <app-id>.desktop; the window icon comes from the staged icon
theme. linux.window sets the initial size, minimum size, resizability and
title. res:// images resolve from App_Resources/Linux/images.
feat(linux): ScrollView, TextField, TextView, Switch, Slider, Progres... 3128569
...s, ActivityIndicator, SearchBar, HtmlView

- containers inside GTK scrolling viewports report their NativeScript frame
  as their size; only views NativeScript never laid out run a layout pass
- widget CSS changes re-measure the owning view; sub-part styling (switch
  thumb, scale highlight, progress fill, links) via scoped display CSS
feat(linux): Image, DatePicker, TimePicker, ListPicker, SegmentedBar 0206d7e
Image is a GtkPicture over the source's GdkTexture (measured like iOS),
pickers use GtkCalendar, spin buttons and GtkDropDown, SegmentedBar is a
linked toggle button group. Also fixes TextView sizing (GTK validates text
lines lazily) and drops the platformCheck import that webpack 5.112 leaves
unresolved.
feat(linux): gestures on GTK 4 controllers 13950b4
tap / doubleTap (GtkGestureClick), longPress, pan and touch (GtkGestureDrag),
swipe, pinch (GtkGestureZoom) and rotation, with iOS semantics: taps don't
fire for drags or long presses, pans start after movement, still releases
aren't swipes. Signal trampolines now take typed (double / int) arguments.
feat(linux): alert, confirm, prompt, login and action dialogs 7b3e9f1
Modal windows over the app window built from GTK widgets (GTK 4.6 has no
GtkAlertDialog): primary button is the default, Return in an entry submits,
closing the window resolves as cancel unless cancelable is false.
feat(linux): frame-driven animations 8a88bbd
Tweens opacity, backgroundColor, translate, scale, rotate, width and height
with CSS / Core Animation cubic-bezier curves, delays, iterations (including
infinite), sequential playback and cancel. GTK 4.6's GL renderer shears
views that are both rotated and translucent (fine with GSK_RENDERER=cairo
and newer GTK).
feat(linux): ListView on GtkListView bc97fad
Virtualized rows: a GtkStringList of placeholders backs a GtkListView, and
each bound row hosts a NativeScript view from the item template (itemLoading,
template selector, rowHeight, itemTap, loadMoreItems, scrollToIndex).

Views a parent hosts in a GTK widget (list rows, ActionBar.titleView) now
answer GTK's measure with a NativeScript measure and lay themselves out.
feat(linux): TabView on GtkNotebook 51d8cb0
Each item's view is a hosted page laid out by NativeScript; items load once
the TabView loads (as on iOS); tab switches feed selectedIndex; tab text,
selected text, background and font size through scoped CSS.
feat(linux): SplitView layout, WebView fallback 40abd00
SplitView lays out primary | supplementary | secondary | inspector columns
from the preferred width fractions, with show/hide per role. WebView opens
pages in the desktop browser until WebKitGTK 6.0 is in the metadata.
fix(linux): hot module replacement reloads the edited page 396195c
As on iOS, livesync goes to the root view, which replaces the page whose
module changed and resets the root content when nothing handled it
(Frame.reloadPage is Android only).
feat(core): linux native-api-usage.json for metadata filtering, C typ... c293fd2
...ings with macro constants
feat(vite): linux platform (build, HMR via the runtime's ns:module) 53f6ad1 fix(vite): purge transform caches on TypeScript flavor hot updates acd2924

nx-cloud
Bot
commented Nov 7, 2026 · edited Loading



Copy link Copy Markdown

View your CI Pipeline Execution ↗ for commit 708bfb3

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 5s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-21 23:28:23 UTC

pkg-pr-new
Bot
commented Nov 7, 2026 · edited Loading



Copy link Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11620
npm i https://pkg.pr.new/@nativescript/vite@11620
npm i https://pkg.pr.new/@nativescript/webpack@11620

commit: 708bfb3

triniwiz added 4 commits November 6, 2026 22:50 fix(linux): AppStream-valid default metainfo (description, release) 59ce879 chore(linux): default icon from the app templates' NativeScript artwork d9beac2 feat(linux): linux.appearance pins a light or dark GTK theme deee1d6
'system' (the default) follows the desktop. 'light' or 'dark' set GtkSettings for the app, so a light app theme stays readable on a dark desktop, like a fixed Android app theme.
feat(linux): requestAnimationFrame at the display refresh rate add6df5
Frames come from the window's GDK frame clock (as CADisplayLink / Choreographer on iOS / Android), in g_get_monotonic_time() milliseconds; a ~60 Hz timer only until the first window exists.
This was referenced Nov 7, 2026 feat: Linux support triniwiz/nativescript-mason#172 Merged feat: Linux support NativeScript/canvas#189 Merged triniwiz added 8 commits November 7, 2026 04:53 fix(linux): keep a page's focus across navigation bb2d0c4
GTK gave the returning page's first focusable widget focus, and a ScrollView holding it scrolled
back to it. The page's focused view is now restored instead.
docs(linux): appearance and config docs without toolkit details 9b2e9f3 feat(linux): read app files from the app bundle 71e9fe8
File, Folder and ImageSource read the app folder through the runtime's
app.nsbundle when one is mounted (zero-copy for unencrypted bundles);
writes inside it fail with EROFS.
feat(linux): bundle, bundleUnpack, sourceProtect and fuses config e5ac69a fix(linux): balanced, escaped markup from HtmlView html 7906dfb
Unclosed or stray tags and raw & / < in hrefs made GTK reject the whole
markup (the label kept its old text). Open tags are now tracked and closed,
and href values escaped.
fix(linux): ImageSource.toBase64String without a temp file b612c2c
Encodes the PNG in memory instead of leaving ns-image-<ms>.png files (which
collided within the same millisecond) in the cache folder.
fix(linux): HtmlView only opens http, https and mailto links 447f6ed
HTML content may be untrusted: file://, custom schemes and desktop
launchers no longer open.
feat(linux): linux.v8Flags config 697a377 triniwiz added 7 commits November 8, 2026 06:15 fix(linux): CSS keyframe animations, mouse enter/leave/move and Activ... 9f94e72
...ityIndicator spin (#11623)

* fix(linux): CSS keyframe animations write keyframe values

KeyframeAnimation sets the style's keyframe values when it starts, and they win
over local values, so the Linux Animation's local writes didn't show until the
animation ended (animate-pulse never pulsed). Like iOS and Android, an animation
with valueSource 'keyframe' now writes the keyframe values.

* feat(linux): mouseEnter, mouseLeave and mouseMove events

A GtkEventControllerMotion, attached while any of them has a listener, raises
the events (mouseMove with getX/getY) and keeps the hover visual state, as
Windows does. MasonKit's :hover and onMouseLeave relied on them.

* fix(linux): ActivityIndicator spins when busy is set before it's shown

GTK left the spinner's CSS animation still when gtk_spinner_start ran before
the widget was on screen (or inside its map signal), until a theme change
restyled it. It now starts on the turn after the spinner is mapped.
fix(linux): restore a page's focus without scrolling to it (#11625) 67f1c96 fix(vite): replay the launch event for frameworks that call run() aft... ecff5a5
...er the placeholder

On Linux, Application.run() fires the one-shot launch event while the HMR
placeholder boots, before the app entry loads. Angular registers its launch
listener later and calls run() without an entry, which the patched run()
ignored, so the app never bootstrapped. Replay the launch event once and
install the root a listener supplies.
fix(vite): read the CLI-written package.json in the HMR core bundle 77867dd
Core reads the app config with require('~/package.json'), but the core
bundle served it as an ESM default export, so require() returned
{ default } and Linux never set the program name, app name or window
title. Serve it as CommonJS that loads the CLI-written package.json on
device, with nativescript.config as the fallback.
fix(linux): request animation frames one at a time 3456c82
FPSCallback started and stopped continuous updating on the window's frame
clock (through a tick callback) for every animation. GTK 4.6 resets its
frame-time smoothing each time updating starts, and doing that repeatedly
stalls GTK's own CSS animations: a GtkSpinner stops turning while short
view animations run. Request the next UPDATE phase from the clock on each
frame instead, as requestAnimationFrame does.
fix(linux): load a page again when navigating back to it 6122649
Forward navigation unloads the outgoing page but leaves it in the frame,
so going back showed it without raising loaded and its views stayed
unloaded.
Merge branch 'feat/windows' into feat/linux 708bfb3

This branch has not been deployed


No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

1 participant