# gnome/gnome-shell architecture

> Architecture diagram of the GitHub repository gnome/gnome-shell, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gnome/gnome-shell
- Repository: https://github.com/gnome/gnome-shell

## Overview

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: [`js/ui/main.js`](https://github.com/gnome/gnome-shell/blob/main/js/ui/main.js) (Shell runtime), [`js/dbusServices/dbusService.js`](https://github.com/gnome/gnome-shell/blob/main/js/dbusServices/dbusService.js) (DBus services), [`src/st/st-widget.c`](https://github.com/gnome/gnome-shell/blob/main/src/st/st-widget.c) (St toolkit), [`src/shell-global.c`](https://github.com/gnome/gnome-shell/blob/main/src/shell-global.c) (Shell core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_src["Native core"]
  node_node_src_main["Shell entry<br/>C bootstrap<br/>[main.c]"]
  node_node_src_global["Shell core<br/>C integration<br/>[shell-global.c]"]
  node_node_src_window["Window layer<br/>C windowing"]
  node_node_src_effects["Effects & agents<br/>C helpers<br/>[shell-screenshot.c]"]
  node_node_src_st["St toolkit<br/>UI toolkit<br/>[st-widget.c]"]
end

subgraph group_group_js["GJS shell"]
  node_node_js_init["JS bootstrap<br/>GJS startup<br/>[init.js]"]
  node_node_js_main["Shell runtime<br/>GJS orchestrator<br/>[main.js]"]
  node_node_js_overview["Overview UI<br/>GJS UI<br/>[overview.js]"]
  node_node_js_panel["Panel & status<br/>GJS UI<br/>[panel.js]"]
  node_node_js_dialogs["Dialogs & prompts<br/>GJS UI<br/>[runDialog.js]"]
  node_node_js_notify["Notifications<br/>GJS UI<br/>[messageTray.js]"]
  node_node_js_window["Window mgmt UI<br/>GJS UI<br/>[windowManager.js]"]
  node_node_js_misc["Shared logic<br/>GJS services<br/>[dbusUtils.js]"]
  node_node_js_gdm["GDM flows<br/>GJS login<br/>[loginDialog.js]"]
  node_node_js_dbus["DBus services<br/>GJS IPC<br/>[dbusService.js]"]
end

subgraph group_group_data["Runtime assets"]
  node_node_data_assets["Assets bundle<br/>resources"]
  node_node_data_theme["Theme system<br/>Sass/CSS"]
end

subgraph group_group_ext["Extensions"]
  node_node_ext_app["Extensions app<br/>subproject UI<br/>[main.js]"]
  node_node_ext_tool["Extensions tool<br/>CLI subproject<br/>[main.c]"]
end

subgraph group_group_tests["Tests"]
  node_node_tests_shell["Shell tests<br/>integration tests<br/>[core.js]"]
  node_node_tests_unit["Unit tests<br/>JS tests<br/>[extensionUtils.js]"]
  node_node_tests_mocks["DBus mocks<br/>test support"]
end

node_node_src_main -->|"starts"| node_node_src_global
node_node_src_main -->|"boots JS"| node_node_js_init
node_node_js_init -->|"loads"| node_node_js_main
node_node_js_main -->|"orchestrates"| node_node_js_overview
node_node_js_main -->|"orchestrates"| node_node_js_panel
node_node_js_main -->|"orchestrates"| node_node_js_dialogs
node_node_js_main -->|"orchestrates"| node_node_js_notify
node_node_js_main -->|"orchestrates"| node_node_js_window
node_node_js_main -->|"uses"| node_node_js_misc
node_node_js_main -->|"hosts"| node_node_js_dbus
node_node_js_main -->|"switches mode"| node_node_js_gdm
node_node_src_global -->|"tracks"| node_node_src_window
node_node_src_global -->|"bridges"| node_node_src_effects
node_node_js_main -->|"binds to"| node_node_src_global
node_node_src_st -->|"skins"| node_node_js_panel
node_node_src_st -->|"skins"| node_node_js_overview
node_node_src_st -->|"skins"| node_node_js_dialogs
node_node_data_assets -->|"defines interfaces"| node_node_js_dbus
node_node_data_assets -->|"configures"| node_node_js_main
node_node_data_theme -->|"themes"| node_node_src_st
node_node_data_theme -->|"themes"| node_node_js_panel
node_node_js_dbus -->|"implements"| node_node_js_notify
node_node_js_dbus -->|"exposed by"| node_node_js_main
node_node_ext_app -->|"administers"| node_node_js_dbus
node_node_ext_tool -->|"manages"| node_node_js_dbus
node_node_js_misc -->|"supports"| node_node_ext_tool
node_node_tests_shell -->|"exercises"| node_node_js_main
node_node_tests_shell -->|"launches"| node_node_src_main
node_node_tests_unit -->|"covers"| node_node_js_misc
node_node_tests_mocks -->|"supports"| node_node_tests_shell

click node_node_src_main "https://github.com/gnome/gnome-shell/blob/main/src/main.c"
click node_node_src_global "https://github.com/gnome/gnome-shell/blob/main/src/shell-global.c"
click node_node_src_window "https://github.com/gnome/gnome-shell/blob/main/src/shell-window-tracker.c"
click node_node_src_effects "https://github.com/gnome/gnome-shell/blob/main/src/shell-screenshot.c"
click node_node_src_st "https://github.com/gnome/gnome-shell/blob/main/src/st/st-widget.c"
click node_node_js_init "https://github.com/gnome/gnome-shell/blob/main/js/ui/init.js"
click node_node_js_main "https://github.com/gnome/gnome-shell/blob/main/js/ui/main.js"
click node_node_js_overview "https://github.com/gnome/gnome-shell/blob/main/js/ui/overview.js"
click node_node_js_panel "https://github.com/gnome/gnome-shell/blob/main/js/ui/panel.js"
click node_node_js_dialogs "https://github.com/gnome/gnome-shell/blob/main/js/ui/runDialog.js"
click node_node_js_notify "https://github.com/gnome/gnome-shell/blob/main/js/ui/messageTray.js"
click node_node_js_window "https://github.com/gnome/gnome-shell/blob/main/js/ui/windowManager.js"
click node_node_js_misc "https://github.com/gnome/gnome-shell/blob/main/js/misc/dbusUtils.js"
click node_node_js_gdm "https://github.com/gnome/gnome-shell/blob/main/js/gdm/loginDialog.js"
click node_node_js_dbus "https://github.com/gnome/gnome-shell/blob/main/js/dbusServices/dbusService.js"
click node_node_data_assets "https://github.com/gnome/gnome-shell/blob/main/data/gnome-shell-dbus-interfaces.gresource.xml"
click node_node_data_theme "https://github.com/gnome/gnome-shell/blob/main/data/theme/gnome-shell-light.scss"
click node_node_ext_app "https://github.com/gnome/gnome-shell/blob/main/subprojects/extensions-app/js/main.js"
click node_node_ext_tool "https://github.com/gnome/gnome-shell/blob/main/subprojects/extensions-tool/src/main.c"
click node_node_tests_shell "https://github.com/gnome/gnome-shell/blob/main/tests/shell/core.js"
click node_node_tests_unit "https://github.com/gnome/gnome-shell/blob/main/tests/unit/extensionUtils.js"
click node_node_tests_mocks "https://github.com/gnome/gnome-shell/blob/main/tests/dbusmock-templates/accounts_service.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_src_main,node_node_src_global,node_node_src_window,node_node_src_effects,node_node_src_st toneBlue
class node_node_js_init,node_node_js_main,node_node_js_overview,node_node_js_panel,node_node_js_dialogs,node_node_js_notify,node_node_js_window,node_node_js_misc,node_node_js_gdm,node_node_js_dbus toneAmber
class node_node_data_assets,node_node_data_theme toneMint
class node_node_ext_app,node_node_ext_tool toneRose
class node_node_tests_shell,node_node_tests_unit,node_node_tests_mocks toneIndigo
```

## Components

### Native core

C runtime, Mutter integration, and shell-native helpers.

- [Shell entry](https://github.com/gnome/gnome-shell/blob/main/src/main.c): C bootstrap · Process startup and plugin entrypoints for the shell host process. · `src/main.c`
- [Shell core](https://github.com/gnome/gnome-shell/blob/main/src/shell-global.c): C integration · Global shell state and bridges into compositor, input, and session services. · `src/shell-global.c`
- [Window layer](https://github.com/gnome/gnome-shell/blob/main/src/shell-window-tracker.c): C windowing · Window tracking, workspace/background, previews, and WM-facing helpers. · `src/shell-window-tracker.c`
- [Effects & agents](https://github.com/gnome/gnome-shell/blob/main/src/shell-screenshot.c): C helpers · Native helpers for screenshots, tray, network, keyring, polkit, and visual effects. · `src/shell-screenshot.c`
- [St toolkit](https://github.com/gnome/gnome-shell/blob/main/src/st/st-widget.c): UI 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](https://github.com/gnome/gnome-shell/blob/main/js/ui/init.js): GJS startup · Initial shell environment and main runtime wiring. · `js/ui/init.js`
- [Shell runtime](https://github.com/gnome/gnome-shell/blob/main/js/ui/main.js): GJS orchestrator · Top-level shell lifecycle, session mode, and subsystem coordination. · `js/ui/main.js`
- [Overview UI](https://github.com/gnome/gnome-shell/blob/main/js/ui/overview.js): GJS UI · Desktop overview, app grid, dash, search, workspaces, and switching flows. · `js/ui/overview.js`
- [Panel & status](https://github.com/gnome/gnome-shell/blob/main/js/ui/panel.js): GJS UI · Top bar, date menu, quick settings, and shell status indicators. · `js/ui/panel.js`
- [Dialogs & prompts](https://github.com/gnome/gnome-shell/blob/main/js/ui/runDialog.js): GJS UI · Run, unlock, login, end-session, access, and modal dialog flows. · `js/ui/runDialog.js`
- [Notifications](https://github.com/gnome/gnome-shell/blob/main/js/ui/messageTray.js): GJS UI · Message tray, notification daemon UI, OSDs, and attention handling. · `js/ui/messageTray.js`
- [Window mgmt UI](https://github.com/gnome/gnome-shell/blob/main/js/ui/windowManager.js): GJS UI · Window menu, previews, alt-tab, workspace switching, and movement gestures. · `js/ui/windowManager.js`
- [Shared logic](https://github.com/gnome/gnome-shell/blob/main/js/misc/dbusUtils.js): GJS services · Reusable shell logic for DBus, extensions, input methods, session helpers, and policies. · `js/misc/dbusUtils.js`
- [GDM flows](https://github.com/gnome/gnome-shell/blob/main/js/gdm/loginDialog.js): GJS login · Greeter and authentication plumbing for login-dialog and pre-session mode. · `js/gdm/loginDialog.js`
- [DBus services](https://github.com/gnome/gnome-shell/blob/main/js/dbusServices/dbusService.js): GJS IPC · 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](https://github.com/gnome/gnome-shell/blob/main/data/gnome-shell-dbus-interfaces.gresource.xml): resources · Schemas, DBus XML, defaults, icons, sound effects, OSK layouts, and compiled resources. · `data/gnome-shell-dbus-interfaces.gresource.xml`
- [Theme system](https://github.com/gnome/gnome-shell/blob/main/data/theme/gnome-shell-light.scss): Sass/CSS · 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](https://github.com/gnome/gnome-shell/blob/main/subprojects/extensions-app/js/main.js): subproject UI · Graphical manager for browsing and configuring shell extensions. · `subprojects/extensions-app/js/main.js`
- [Extensions tool](https://github.com/gnome/gnome-shell/blob/main/subprojects/extensions-tool/src/main.c): CLI subproject · 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](https://github.com/gnome/gnome-shell/blob/main/tests/shell/core.js): integration tests · Headless and multi-monitor shell scenarios exercising compositor-integrated behavior. · `tests/shell/core.js`
- [Unit tests](https://github.com/gnome/gnome-shell/blob/main/tests/unit/extensionUtils.js): JS tests · Focused JavaScript tests for utilities and shell logic. · `tests/unit/extensionUtils.js`
- [DBus mocks](https://github.com/gnome/gnome-shell/blob/main/tests/dbusmock-templates/accounts_service.py): test support · Mock desktop services and DBus runners used by shell integration tests. · `tests/dbusmock-templates/accounts_service.py`

## Connections

- 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.
