Bus, Ui, main: the system's appearance, dark or light and its accent
The desktop portal's org.freedesktop.appearance settings on the session bus say whether the system prefers dark (color-scheme 1) and which accent colour it uses, and a flatpak may read them. Bus:Appearance subscribes to SettingChanged and reads the namespace in one ReadAll call, which every portal version has, so a start waits for one answer at most, 2 s; a portal that gave no colour scheme by then — still starting, or not on the bus yet — is asked again when its name has an owner, without waiting, and its answer comes as a change. The canvas gained a dark palette and takes the accent for the avatars, badges, buttons and outgoing bubbles, with the text on it dark or light by the accent's brightness. The app applies the theme to the window at once and keeps it for the next one; --theme dark|light or IMSD_MESSAGES_THEME (the same two values: another is refused on the command line and ignored in the environment) overrides the portal's colour scheme, for benches and desktops without a portal.
This commit is contained in:
parent
4342c84d8f
commit
9332094333
7 changed files with 222 additions and 7 deletions
|
|
@ -111,8 +111,9 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
|
|||
}
|
||||
|
||||
// imsd-messages-bus — the GLib side: imsd's dictionaries, the GDBus client
|
||||
// of net.catcrafts.IMS1.Messaging, the desktop notifications and the app's
|
||||
// own session-bus name. No window.
|
||||
// of net.catcrafts.IMS1.Messaging, the desktop notifications, the app's
|
||||
// own session-bus name and the desktop portal's appearance settings. No
|
||||
// window.
|
||||
static auto Bus = std::make_unique<Configuration>();
|
||||
Bus->path = "./";
|
||||
Bus->name = "imsd-messages-bus";
|
||||
|
|
@ -121,11 +122,12 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
|
|||
Bus->type = ConfigurationType::LibraryStatic;
|
||||
Bus->dependencies = { Core.get() };
|
||||
{
|
||||
std::array<fs::path, 5> ifaces = {
|
||||
std::array<fs::path, 6> ifaces = {
|
||||
"interfaces/ImsdMessages.Bus",
|
||||
"interfaces/ImsdMessages.Bus-Variant",
|
||||
"interfaces/ImsdMessages.Bus-Client",
|
||||
"interfaces/ImsdMessages.Bus-Notifier",
|
||||
"interfaces/ImsdMessages.Bus-Appearance",
|
||||
"interfaces/ImsdMessages.Bus-Instance",
|
||||
};
|
||||
std::array<fs::path, 0> impls = {};
|
||||
|
|
|
|||
Loading…
Reference in a new issue