How gnome/gnome-shell works
1. What this repository is
GNOME Shell is the desktop shell and session UI for GNOME. Architecturally, it sits between the compositor/window manager layer and the user, handling app launching, window switching, overview, notifications, system status, and session dialogs.
2. Two primary runtime layers
The codebase is split between:
- C code in src/, which provides the executable, Mutter integration, performance-sensitive primitives, and native helpers.
- JavaScript (GJS) in js/, which implements most shell behavior, UI composition, session logic, and D-Bus services.
This is not a pure JS app: the shell runs as a native process with embedded JS runtime and deep compositor integration.
3. Core startup and process boundary
The main shell process is started from src/main.c and the shell plugin entrypoints in src/gnome-shell-plugin.c. Once the runtime is initialized, the JS side bootstraps through js/ui/init.js and js/ui/main.js. The shell then owns the desktop session UI and reacts to compositor, input, and system events.
4. Main UI subsystem
js/ui/ is the largest architectural block. It contains the visible shell components:
- top panel, overview, dash, app grid, quick settings, calendar, run dialog, unlock/lock dialogs
- window and workspace management UI
- notifications, message tray, OSDs, accessibility dialogs, magnifier, screenshot and screencast UI
- input/interaction helpers such as DnD, gestures, pointer watching, modal dialogs
This layer is the orchestration center for user-facing behavior.
5. Shared shell logic and service integration
js/misc/ holds reusable non-visual logic: D-Bus helpers, extension utilities, login/session helpers, keyboard/input method glue, system actions, parental controls, weather, history, and various managers. These modules are the “service layer” used by the UI and other subsystems.
6. Session, login, and GDM-related flows
js/gdm/ contains the login-dialog and authentication plumbing used when GNOME Shell is acting in the greeter/login context. This includes credential handling and integration with services such as realmd and virtualization-related auth paths. This is a separate mode from the regular user session UI.
7. D-Bus services hosted by the shell
js/dbusServices/ provides shell-owned service processes for features that are exposed over D-Bus:
- notifications daemon
- screencast service
- screensaver service
- extension preferences / extension management service
- portal helper
These are surfaced by service files and resource bundles under data/ and are part of the shell’s IPC boundary with the rest of the desktop.
8. Native support code in src/
The C code supplies key integration points and internal objects such as:
- window tracking, workspace/background handling, window previews
- screenshot, tray, mount, network, polkit, keyring, perf/logging helpers
- shell-specific effects and geometry/stacking helpers
- hotplug sniffing and calendar-server support
This code bridges JS UI logic to Mutter/Clutter/GTK and lower-level desktop facilities.
9. The st toolkit
src/st/ is the shell toolkit: custom widgets, themeing, text/clipboard, scrolling, icons, accessibility, and theme-node logic. It is the UI foundation beneath js/ui/ and is distinct from generic GTK application code. It also carries styling infrastructure and theme parsing support.
10. Data, resources, and theming
data/ contains the shell’s runtime assets and configuration:
- GSettings schemas and overrides
- D-Bus interface XML definitions
- default app/category mappings
- keyboard/OSK layouts
- sound effects, icons, and theme resources
- compiled resource manifests for JS and CSS
Theme assets live under data/theme/, with light, dark, and high-contrast variants generated from Sass sources. This asset bundle is part of the shell runtime, not just build-time decoration.
11. Extension ecosystem as first-class architecture
The repo includes two related subprojects:
- subprojects/extensions-app/: the graphical extensions manager
- subprojects/extensions-tool/: CLI tooling for listing, installing, packing, enabling, and uploading extensions
The main shell also contains extension loading, prefs, and downloader logic, so extensions are a core extension point, not an add-on.
12. Testing architecture
Tests are split into:
- JS unit tests under tests/unit/
- shell/integration tests under tests/shell/
- D-Bus mock templates and runners for simulating desktop services
This reflects the shell’s dependency-heavy environment: many behaviors are validated through mocked IPC and session components rather than isolated pure functions.
13. Build, packaging, and CI
The project uses Meson/Ninja with GitLab CI. Build logic is distributed across meson.build files, and generated resources/translations are part of the build graph. The CI scripts also cover toolbox images, linting, and translation/potfile maintenance. This matters architecturally because assets, schemas, DBus XML, and JS resources are all compiled into the shipped runtime.
14. Important boundary to capture in a diagram
A good diagram should show GNOME Shell as a native compositor-integrated host process with:
- a C/Mutter-facing core
- a GJS-driven UI/service layer
- D-Bus connections to many desktop/system services
- resource/theme assets loaded at runtime
- extension and tooling sidecars as separate but tightly related components
Main entry points: main.js Shell runtime · dbusService.js DBus services · st-widget.c St toolkit · shell-global.c Shell core
Components 22
Native core
C runtime, Mutter integration, and shell-native helpers.
- Shell entry · Process startup and plugin entrypoints for the shell host process.
src/main.c - Shell core · Global shell state and bridges into compositor, input, and session services.
src/shell-global.c - Window layer · Window tracking, workspace/background, previews, and WM-facing helpers.
src/shell-window-tracker.c - Effects & agents · Native helpers for screenshots, tray, network, keyring, polkit, and visual effects.
src/shell-screenshot.c - St toolkit · Shell-specific widget, theme, accessibility, text, and scrolling toolkit.
src/st/st-widget.c
GJS shell
Main shell logic, UI, dialogs, and D-Bus services.
- JS bootstrap · Initial shell environment and main runtime wiring.
js/ui/init.js - Shell runtime · Top-level shell lifecycle, session mode, and subsystem coordination.
js/ui/main.js - Overview UI · Desktop overview, app grid, dash, search, workspaces, and switching flows.
js/ui/overview.js - Panel & status · Top bar, date menu, quick settings, and shell status indicators.
js/ui/panel.js - Dialogs & prompts · Run, unlock, login, end-session, access, and modal dialog flows.
js/ui/runDialog.js - Notifications · Message tray, notification daemon UI, OSDs, and attention handling.
js/ui/messageTray.js - Window mgmt UI · Window menu, previews, alt-tab, workspace switching, and movement gestures.
js/ui/windowManager.js - Shared logic · Reusable shell logic for DBus, extensions, input methods, session helpers, and policies.
js/misc/dbusUtils.js - GDM flows · Greeter and authentication plumbing for login-dialog and pre-session mode.
js/gdm/loginDialog.js - DBus services · Shell-hosted DBus services for notifications, screencast, screensaver, extensions, and portal helper.
js/dbusServices/dbusService.js
Runtime assets
Schemas, interfaces, themes, sounds, layouts, and resources.
- Assets bundle · Schemas, DBus XML, defaults, icons, sound effects, OSK layouts, and compiled resources.
data/gnome-shell-dbus-interfaces.gresource.xml - Theme system · Shell theme sources and light/dark/high-contrast variants.
data/theme/gnome-shell-light.scss
Extensions
Extension manager app, CLI, and shell extension hooks.
- Extensions app · Graphical manager for browsing and configuring shell extensions.
subprojects/extensions-app/js/main.js - Extensions tool · Command-line tooling for listing, installing, packing, enabling, and uploading extensions.
subprojects/extensions-tool/src/main.c
Tests
Shell integration tests, unit tests, and D-Bus mocks.
- Shell tests · Headless and multi-monitor shell scenarios exercising compositor-integrated behavior.
tests/shell/core.js - Unit tests · Focused JavaScript tests for utilities and shell logic.
tests/unit/extensionUtils.js - DBus mocks · Mock desktop services and DBus runners used by shell integration tests.
tests/dbusmock-templates/accounts_service.py
Connections 30
- Shell entry → Shell core: starts · Native entry initializes shell core state.
- Shell entry → JS bootstrap: boots JS · Startup hands off to the embedded GJS bootstrap.
- JS bootstrap → Shell runtime: loads · Bootstrap enters the main shell orchestrator.
- Shell runtime → Overview UI: orchestrates · Main lifecycle coordinates the overview and app launching surface.
- Shell runtime → Panel & status: orchestrates · Main lifecycle manages panel and system status UI.
- Shell runtime → Dialogs & prompts: orchestrates · Main lifecycle controls modal dialogs and session prompts.
- Shell runtime → Notifications: orchestrates · Main lifecycle wires notification and OSD behavior.
- Shell runtime → Window mgmt UI: orchestrates · Main lifecycle delegates window switching and workspace UI.
- Shell runtime → Shared logic: uses · Shell runtime depends on shared service and policy helpers.
- Shell runtime → DBus services: hosts · Main shell process exposes DBus services.
- Shell runtime → GDM flows: switches mode · Shell can enter greeter/login flows.
- Shell core → Window layer: tracks · Core integrates window tracking and workspace state.
- Shell core → Effects & agents: bridges · Core provides native helpers for shell features.
- Shell runtime → Shell core: binds to · JS runtime sits on the native compositor/session bridge.
- St toolkit → Panel & status: skins · Toolkit underpins visible shell widgets and controls.
- St toolkit → Overview UI: skins · Toolkit supports overview and app grid UI.
- St toolkit → Dialogs & prompts: skins · Toolkit supports dialogs, entries, and popups.
- Assets bundle → DBus services: defines interfaces · DBus XML and schemas define service boundaries.
- Assets bundle → Shell runtime: configures · Runtime assets and settings shape shell behavior.
- Theme system → St toolkit: themes · Theme sources style the shell toolkit.
- Theme system → Panel & status: themes · Theme assets style top-level shell UI.
- DBus services → Notifications: implements · Notifications service is hosted from the shell side.
- DBus services → Shell runtime: exposed by · Services are part of the shell process boundary.
- Extensions app → DBus services: administers · Extensions app talks to shell extension service.
- Extensions tool → DBus services: manages · CLI tool manages extensions through shell APIs.
- Shared logic → Extensions tool: supports · Shared extension logic is reused by tooling.
- Shell tests → Shell runtime: exercises · Integration tests run the shell runtime end to end.
- Shell tests → Shell entry: launches · Shell tests start the native host process.
- Unit tests → Shared logic: covers · Unit tests validate reusable JS helpers.
- DBus mocks → Shell tests: supports · DBus mocks simulate desktop services for integration tests.