Summary

In order to let developers to know more about deepin, this article will provide descriptions with pictures to explain the architectural design of deepin and the function of basic modules. This will help developers take a global view of the design idea and directions. All the detailed implement code and modules will be omitted here, for more information on code, please refer to https://github.com/linuxdeepin.

Architecture Overview

A complete desktop operation system can be divided as the following layers:

Kernel/Driver It is for hardware like CPU, memory and disk, etc. and it needs to be compatible with different netcard, display card, sound card and IO devices, etc.
Display Server Boot from kernel, we can see the plymouth(also system splash screen), and when you see the login screen and it prompts you to enter the passwrd, the display driver, also X Server, is just started. It is the god for graphical interface of Linux system. All the painting request will be send to X Server to handle. Also it is the abstract layer for input and display, developers can use the X11/XCB APIs without concerning the detailed information of the drivers. But now most users will use the higher GTK+/Qt library to write their applications.
Display Manager Simply it is the interface that you can enter the password, the login screen
Resource Manager It is a series of daemon process to monitor the hardware status and it will provide information to desktop environment and applications like network, power, disk, Bluetooth, sound, keyboard and printer, etc.
Desktop Environment As for Deepin Desktop Environment, it contains backend services and daemon processes. A full desktop environemnt will provide graphical development tookit, binary tools and DBus API. We will later explain these parts.
App Store It provides operations for software install, remove and upgrade, etc. and it keeps the user to manage software conveniently and can comment and rate the software.
Applications It is mainly Deepin Original Applications, cooperated applications, Android, Windows and even Web applications

Display Manager

We will first introduce the display manager. The display manager will be started after the X Server has successfully started.

deepin is using the LightDM, developed by Ubuntu. Other major display managers are GDM from GNOME, KDM from KDE. Using LightDM is that it is very lightweight and will not bind any desktop environment, and it provided custom interface for GTK+, Qt and HTML5, etc. It is very convenient.

The display manager is mainly providing the authentication and user switch functions for now login users according to the system configured user permissions. Once the user passed the verification, it will execute the next startup program (commonly the initialization program for desktop environment) from the greeter (config interface for LightDM) to show the desktop environment.

Deepin has developed a frontend interface based on Qt5, called deepin-greeter, like this:

Besides the basic authentication, user switch, date time and shutdown functions, it will also provides:

  • The multimedia control interface (at the bottom right), to let users switch or pause music when the screen is locked or switching user.
  • When startup or unlock with multiple screens, it will switch the main locking interface according to the cursor.
  • It will directly start some of the system services when typing the password, like power, account and bright, etc. After user typed the password, these services can be loaded in advance. This will shorten 30% of the startup time compared with other desktop environments.

DDE Daemon Services

After successfully authed by the display manager, the system will call the exec arguments of the greeter. For deepin, this argument will be startdde. startdde is the application to start the Deepin Desktop Environment. This command will do the following operations to start and display the desktop environment:

  • Perform the basic desktop session management, like logout and reboot operations;
  • Set the whole system theme by xsettings to let the desktop environment and both the GTK+ and Qt applications can load the user theme successfully. the DPI of the screen is also loaded at this stage;
  • Handle the startup method of the apllications by specfications provided by freedesktop, including execute *.desktop files and do alarm events;
  • Manage multiple screens that can normally show the dock and desktop on main screen;
  • Handle the startup order of the applications. For example, it will first start the dde core components and then other application, to avoid other applications run at the same time, as some of the system services are not loaded, this could cause race condition. And the startdde program can judge whether one program can be loaded or not, to let the startup process in a good order;

When the startdde program loaded, it will run the dde-session-initializer process to provide backend service for the dock and launcher, including:

  • Manage the resident programs of the dock and launcher;
  • Maintain the start status of the applications;
  • Maintain the status of the workspace and location for applications;
  • Maintain the status and icons of installed applications;

dde-session-initializer is a daemon process for the dock and launcher and provide core function for them. We cannot click on the application icons and switch the windows of the programs without this process.

dde-session-initializer was previously a part of the dde-session-daemon, we divided this process to boost the dock and launcher.

dde-session-daemon and dde-system-daemon are the two main daemon process for the whole system. They maintain all the status of the hardware, including netcard, power, disk, Bluetooth, sound, printer, auth, sharing, keyboard and mouse, etc. to encapsulate all the daemon process and provide the user design oriented interface.

dde-session-daemon contains the operations that do not need root priviledge like sound, keyboard and mouse and date time. dde-system-daemon contains the other part that need root priviledge like power, account, file operations and bright, etc. This design of the sandbox process can limit the permissions and avoid a lot of security issues.

dde-session-daemon and dde-system-daemon do the following parts:

  • Perform the function of account create, delete and management;
  • Manage different status for multiple screens, including location, direction, resolution and bright, etc;
  • Manage default ile associations and theme settings;
  • Manage the network settings for wired and wireless network, VPN and DSL;
  • Manage settings for Bluetooth, sound, date time and timezone, etc;
  • Manage settings for power, keyboard and mouse;
  • Manage system upgrade and boot operations;
  • Provide services for multi-touch pad.

dde-session-initalizer, dde-session-daemon and dde-system-daemon perform as gnome-session-daemon does in GNOME, but Deepin Team use golang to rewrite all the daemon process code for user needs and getting better performance. DDE just like GNOME and KDE to call the infrastructure library(network-manager, upower, udisk, bluez, pluseaudio, cups, polkitd, gvfsd) to provide abstract and advanced services for desktop environment and applications.

DDE API

The desktop environment will provide an API layer above the daemon process of the Deepin Desktop Environment, which contains graphical development toolkit, binary tools and DBus API interface for direct call by desktop environment and applications without implement them from scratch. The DBus API part will be called dynamically by DBus services (and will not resident on memory), you can call the inteface by any programming language. We will introduce from the picture left to right:

DTK

DTK (Deepin Tool Kit) is an UI toolkit suite based on Qt5 to write and unify the Deepin Desktop and Deepin Original Application, its main functions are:

  • Provide single instance inteface to avoid writing it from scratch.
  • Provide a series of functions for moving and zooming by XCB library, no need to refer the X11/XCB functions to create a full borderless window.
  • Provide a bundle of beautiful custom controls without creating them by lower Qt library, it’s ready to work.

If you’re interested in it you can refer the source code here: https://github.com/linuxdeepin/deepin-tool-kit, you can rapidly develop elegant product by our DTK library instead of directly by Qt5 library. And you’re welcome to comment and submit patches for it.

dde-api binary utils

It is mainly the binary tools for developing dde-session-daemon and dde-system-daemon, open the following binaries can let other applications using the core technologies directly and avoid reinventing the wheel:

  • greeter-helper: Provide the settings interface for the language and keyboard, etc. of the locking screen;
  • image-blur-helper: Provide wallpaper blur service, you can rapidly blur an image without writing your own implementation. Deepin Team’s blur algorithm just spend only 30ms to run, it is faster than most of the community implementations;
  • lunar-calendar: Provide service for querying the date and time;
  • powersupply: Provide a high level interface for power info, using udev to obtain power status and battery info;
  • soundutils: Provide interface for playing desktop sound effects;
  • validator: Provide a validator for username without tesing a lot of regex;
  • cursor-helper: Provide the settings for cursor theme;
  • drandr: Provide a high level interface for x11 randr api to get detailed infomation of the monitor;
  • dxinput: Provide a high level interface for x11 xi/xi2 api to get and set the IO devices;
  • And a lot of advanced services provided by this project: https://github.com/linuxdeepin/dde-api, you’re welcomed to extend its function

dde-daemon dbus API

This part was provided for Deepin Control Center, by dde-session-daemon and dde-system-daemon, mainly some DBus interfaces. Other applications can also use this part of API without knowing and writing some lower layer code. We will simply introduce some of the functions, if you are interested in them, you can refer the code of the control center here: https://github.com/linuxdeepin/dde-control-center

  • Query the numbers of the screens, which is the main screen and what resolutions they are of the current system.
  • Query the settings for language, bright and volume, etc. of the current system.
  • Query the network status, like using wired or wireless connection and if opened VPN of the current system.
  • Query the date and time, timezone and keyboard and mouse, etc. of the current system.

All the hardware infomation that the control center showed can be queried by the DBus interface of the dde-api, deepin developer team refined these DBus API for a long time, you can just use them without writing the lower level library(network-manager, pluseaudio, bluez, upower and udisk, etc.) code painfully, to spend more time writing advanced functions.

DDE UI

The last part of the Deepin Desktop Environment is the UI layer, which contains the following parts:

deepin-wm There are two window manager: deepin-metacity and deepin-wm, the system will automaticall choose depending on the hardware performance and display driver. deepin-metacity is a 2D window manager based on metacity for low configuration computer or without installing the proper display driver. It is low resource consumption and has bad animation effects. deepin-wm is a 3D window manager based on mutter and it’s also the default window manager. It is suitable for proper display driver and high configuration computer with elegant animation effects
dde-desktop It provides the basic file grid of the desktop and basic file operations. dde-desktop using the libdde-file-manager library to keep the same dialog like Deepin File Manger(dde-file-manager)
dde-dock It provides graphical dock icon and status management, user can change its position and style
dde-launcher It provides functions for showing installed applications, as well as searching and running them
dde-control-center It provides a frontend interface for hardware resources, like account, theme, network, Bluetooth, sound, IO, default applications, date time, power and system upgrade, etc.
dde-osd It provides OSD interface for volume and bright, etc.
deepin-menu It provides a unified context menu UI
deepin-notificaiton It provides notification service for system to show different jump button for different applications
deepin-policykit-agent It provides a unified password and authenicate dialog for all applications according to the design specifications of Deepin UI to keep both GTK+ and Qt application using the same dialog
deepin-icon-theme The most unified style icon sets on the world, including thousands of the applications on Deepin Store, you can check here: https://github.com/linuxdeepin/deepin-icon-theme/tree/master/deepin
deepin-gtk-theme It is the window theme accroding to the design specifications of Deepin UI (GTK+ 2,GTK+ 3, Qt4 and Qt5)
deepin-default-settings It provides the default settings for Deepin Desktop Environment like wallpaper and icon theme, etc.
qt5-integration It provides the unified interface and theme for GTK+ and Qt applications by patching to the GTK+ and Qt library. You can write once to get the same interface on both GTK+ and Qt applications

Deepin Store

Deepin Store is the first App Store that has good product quality and excellent interaction experience in Linux.

Besides the Deepin Original Applications, we support 50+ Windows applications by deepin-wine project, 200+ Android applications(e.g. Angry Birds and some video client) by builtin Android runtime and HTML5 applications(e.g. Gliffy) by deepin-xwalk cooperated with Intel. The HTML5 application can also remember its window size.

Deepin Store can be divided as lastore-daemon, lastore-session-helper and deepin-appstore:

  • lastore-daemon: It is the core part of the app store, which do the work of package download, hash check, dependency analysis, local cache management, software install, remove and upgrade. This daemon process will communicate with the remote repositories and keep the upgrade and security process of the whole system. lastore-daemon will also add some hooks to apt/dpkg program to prevent the damage from installing in terminal.
  • lastore-session-helper: It is the helper of the lastore-daemon, which will execute some user session operations like sending notificattions to users, to ensure the security when installing the software, we divide these part of the code to lastore-session-helper.
  • deepin-appstore: It is the client and interface of app store, simply a application shell based on CEF to handle the interaction of the user and embed a webpage. Once the server has upgrade a new software, it will tell the deepin-appstore to refresh the webpage. It is also contained the interface for comment and rate operations. Technically the deepin-appstore is a simple web browser like a native client.