2025-07-01 15:03:26 +00:00
|
|
|
/*
|
|
|
|
|
* SPDX-FileCopyrightText: 2025 Florian RICHER <florian.richer@protonmail.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "kwinsettings.h"
|
|
|
|
|
|
|
|
|
|
const QString CONFIG_FILE = QStringLiteral("kwinrc");
|
|
|
|
|
const QString WAYLAND_CONFIG_GROUP = QStringLiteral("Wayland");
|
|
|
|
|
|
|
|
|
|
KWinSettings::KWinSettings(QObject *parent)
|
|
|
|
|
: QObject{parent}
|
panels: Add support for defining device specific panel tweaks
This adds support for specifying options needed to deal with phone
display panel pecularities (ex. screen curves, notches, punch holes)
This is implemented as settings in ~/.config/plasmamobilerc, which can
set panel heights, paddings, and center spacings to duck display
cutouts. The pixel values are scaling independent, and so are not
affected when the display scaling is changed.
This is then exposed over DBus, so that components from outside of
plasmashell (ex. KWin) can access it easily without needing to connect to
kscreen themselves. Each screen is exposed as a single object.
Currently support is only added in the status bar and the navigation
panel.
Currently all screens have the settings applied. In the future, we may
want to limit this just to the internal screen (?)
---
This also adds a "devices" folder (in `devices/configs`) where per-device configs can be set.
This is installed to `/usr/share/plasma-mobile-device-configs`.
In `plasmamobilerc` (installed to `/etc/xdg/plasmamobilerc`, or
`~/.config/plasmamobilerc`), envmanager will read:
```toml
[Device]
device=oneplus-enchilada
```
for the device config to use and write its settings to
`~/.config/plasma-mobile/plasmamobilerc`.
2025-10-05 23:06:52 +00:00
|
|
|
, m_config{KSharedConfig::openConfig(CONFIG_FILE)}
|
2025-07-01 15:03:26 +00:00
|
|
|
{
|
|
|
|
|
m_configWatcher = KConfigWatcher::create(m_config);
|
|
|
|
|
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) -> void {
|
|
|
|
|
Q_UNUSED(names)
|
|
|
|
|
if (group.name() == WAYLAND_CONFIG_GROUP) {
|
|
|
|
|
Q_EMIT doubleTapWakeupChanged();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool KWinSettings::doubleTapWakeup() const
|
|
|
|
|
{
|
|
|
|
|
auto group = KConfigGroup{m_config, WAYLAND_CONFIG_GROUP};
|
|
|
|
|
return group.readEntry("DoubleTapWakeup", true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KWinSettings::setDoubleTapWakeup(bool enabled)
|
|
|
|
|
{
|
|
|
|
|
auto group = KConfigGroup{m_config, WAYLAND_CONFIG_GROUP};
|
|
|
|
|
group.writeEntry("DoubleTapWakeup", enabled, KConfigGroup::Notify);
|
|
|
|
|
m_config->sync();
|
|
|
|
|
}
|