Documentation
¶
Overview ¶
Package linux is NSGo's GTK 4 backend, on NSH's Linux design: every view is a widget of its own (NsgoView, a GtkWidget subclass) that its parent places at the core's frame and that draws itself with GtkSnapshot and Cairo, text the engine measured and laid out with Pango included. Inputs, web views, videos and the app's native components are native GtkEntry, WebKitWebView, GtkPicture and app widgets hosted in their view's widget, so they stack, clip, fade and transform with the views around them. GTK delivers the pointer, wheel and keyboard events and file drops to the surface; the backend hit tests them and the engine keeps the interaction state. Transitions, animated values, layout animations and animated images run on one frame clock that ticks only while something animates.
The backend is the one the roadmap asks for: GTK 4 through purego, no cgo and no hand-written C. It loads its libraries at run time, so an app built on macOS needs only Go and Xcode, and an app built for Linux needs GTK 4.14 or newer, Pango and Cairo where it runs. Web views also need WebKitGTK 6.0, which loads on the first one; without it a web view shows a placeholder, as NSH's does. Videos play through GTK's GStreamer media backend.
The application menu is a GTK menu bar above the surface. The backend does not select text, expose accessibility, draw window controls of its own or animate modals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstalledBy ¶
func InstalledBy() string
InstalledBy names the sandbox whose store installed the app and updates it, Flatpak or Snap, as they mark their apps' environments; "" for any other install, a package manager's included, which nsgo.yaml's updates.channel tells apart.
Types ¶
type Options ¶
type Options struct {
Title string
Width, Height driver.Points
// Hidden keeps the backend's root window out of the screen while it hosts app-level services such as tray icons.
Hidden bool
// MainHidden opens the main window the app's function opens without showing it (nsgo.StartHidden).
MainHidden bool
// ID names the app's directories and storage (engine.AppDirs).
ID string
// Name is the app's name, nsgo.yaml's (core.App().Name), "" where the tool set none; unlike Title, a surface's windows keep it.
Name string
// InstanceKey scopes the single-instance lock; empty keeps one lock per ID.
InstanceKey string
// Components are the native components Native elements name.
Components driver.NativeComponents
// Fonts are font files under the app's resources, registered before
// the first view.
Fonts []string
// Appearance is the appearance the app starts in.
Appearance driver.Appearance
// Constraints limit the window (nsgo.WindowConstraints).
Constraints driver.WindowConstraints
// Transparent opens the window undecorated and clear wherever the app draws nothing, NoShadow without the shadow GTK draws, and SkipTaskbar off the X11 task list (look.go).
Transparent, NoShadow, SkipTaskbar bool
// Perf shows the performance monitor over the app (perf.go).
Perf bool
// Updates is how the app updates (updates.go).
Updates updates.Config
// LaunchedAtLogin says the login item started this process.
LaunchedAtLogin bool
// Host is what an embedding host gives the view (NewView).
Host engine.HostOptions
// contains filtered or unexported fields
}
Options configure the window.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is an app in a GtkWidget of an embedding host's window, which the host's own main loop runs (NewView).
func NewView ¶
NewView makes a GtkWidget showing app, for a host that has initialized GTK and runs its main loop itself. Its engine starts once GTK first allocates the widget, so settings made before that are in the app's first frame. Call it on GTK's thread; several views may show at once. It leaves the program name, which docks match the host's windows by, to the host.
func (*View) Close ¶
func (v *View) Close()
Close stops the app, destroys its native components and lets the widget go, which the host removes from its parent.
func (*View) SetHostEnvironment ¶
func (v *View) SetHostEnvironment(env engine.HostEnvironment)
SetHostEnvironment sets what the host sets over the session's environment: its locale, text size and appearance.
Source Files
¶
- access.go
- access_placeholder.go
- animate.go
- atlas.go
- audio.go
- audiooutput.go
- audioplayer.go
- audiostream.go
- audiotrack.go
- authsession.go
- automation_off.go
- awake.go
- callback.go
- canvas.go
- canvas_vertices.go
- capture.go
- component.go
- constraints.go
- cursor.go
- cursorpoint.go
- dbusmenu.go
- decor.go
- dev_geometry.go
- dev_window_frame_off.go
- direction.go
- discovery.go
- diskspace.go
- edge.go
- editing.go
- effect.go
- entry.go
- env.go
- eyedropper.go
- eyedropper_logic.go
- filedrop.go
- focus.go
- focus_logic.go
- fontlist.go
- fonts.go
- frame.go
- frontmost.go
- frontmost_wayland.go
- fullscreen.go
- gpu.go
- gpu_gl.go
- gst.go
- gtk.go
- hotkey.go
- http.go
- image.go
- input.go
- inputsource.go
- instance.go
- keycodes.go
- launchermenu.go
- layershell.go
- layoutanim.go
- level.go
- linux.go
- login.go
- loginportal.go
- loginsnap.go
- look.go
- menu.go
- menu_speech.go
- menu_sync.go
- menuicon.go
- native.go
- network.go
- notifications.go
- notifications_schedule.go
- offscreen.go
- owned.go
- paint.go
- panel.go
- paneldock.go
- paste.go
- paste_html.go
- perf.go
- permissions.go
- permissions_logic.go
- permissions_pipewire.go
- pointer_transform.go
- pointerlock.go
- pointerlock_wayland.go
- pointerlock_x11.go
- power.go
- preedit.go
- quicklook.go
- quicklook_logic.go
- quit.go
- raster.go
- recent.go
- savepreflight.go
- scan.go
- scheme.go
- scroll.go
- secrets.go
- selection.go
- session.go
- shader.go
- shader_cache.go
- share.go
- shieldscroll.go
- sound.go
- soundplayback.go
- system.go
- testinput.go
- testwebinput.go
- text.go
- text_units.go
- threadloop.go
- timezone.go
- timezone_logic.go
- touch.go
- touch_geometry.go
- touchscroll.go
- tray.go
- uilang.go
- uilang_linux.go
- updates.go
- video.go
- videogstreamer.go
- videohttp.go
- view.go
- wayland.go
- web.go
- webcookie.go
- webinput.go
- webinput_logic.go
- websandbox.go
- webwindow.go
- wheel_logic.go
- widget.go
- windowpointer.go
- workspaces.go
- yield.go