2025-06-25 23:22:58 +00:00
|
|
|
// SPDX-FileCopyrightText: 2025 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
#include "halcyonsettings.h"
|
|
|
|
|
|
2025-07-16 05:42:56 +00:00
|
|
|
using namespace Qt::Literals::StringLiterals;
|
2025-06-25 23:22:58 +00:00
|
|
|
|
2025-07-16 05:42:56 +00:00
|
|
|
// The config group all of the settings are under
|
|
|
|
|
static constexpr auto CFG_GROUP_HALCYON = "Halcyon"_L1;
|
|
|
|
|
|
|
|
|
|
static constexpr auto CFG_KEY_PINNED = "pinned"_L1;
|
|
|
|
|
static constexpr auto CFG_KEY_SHOW_WALLPAPER_BLUR = "wallpaperBlurEffect"_L1;
|
|
|
|
|
static constexpr auto CFG_KEY_DOUBLE_TAP_TO_LOCK = "doubleTapToLock"_L1;
|
|
|
|
|
|
|
|
|
|
HalcyonSettings::HalcyonSettings(Plasma::Applet *applet, QObject *parent)
|
|
|
|
|
: QObject{parent}
|
|
|
|
|
, m_applet{applet}
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString HalcyonSettings::pinned() const
|
2025-06-25 23:22:58 +00:00
|
|
|
{
|
2025-07-16 05:42:56 +00:00
|
|
|
return configGroup().readEntry(CFG_KEY_PINNED, u"{}"_s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HalcyonSettings::setPinned(const QString &pinnedJson)
|
|
|
|
|
{
|
|
|
|
|
// Saved separately from other options, since it's changed from the homescreen (not settings window)
|
|
|
|
|
configGroup().writeEntry(CFG_KEY_PINNED, pinnedJson);
|
|
|
|
|
m_applet->config().sync();
|
2025-06-25 23:22:58 +00:00
|
|
|
}
|
|
|
|
|
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
HalcyonSettings::WallpaperBlurEffect HalcyonSettings::wallpaperBlurEffect() const
|
2025-06-25 23:22:58 +00:00
|
|
|
{
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
return m_wallpaperBlurEffect;
|
2025-06-25 23:22:58 +00:00
|
|
|
}
|
|
|
|
|
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
void HalcyonSettings::setWallpaperBlurEffect(WallpaperBlurEffect wallpaperBlurEffect)
|
2025-06-25 23:22:58 +00:00
|
|
|
{
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
if (m_wallpaperBlurEffect != wallpaperBlurEffect) {
|
|
|
|
|
m_wallpaperBlurEffect = wallpaperBlurEffect;
|
|
|
|
|
Q_EMIT wallpaperBlurEffectChanged();
|
2025-06-25 23:22:58 +00:00
|
|
|
save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-27 04:14:26 +00:00
|
|
|
bool HalcyonSettings::doubleTapToLock() const
|
2025-06-25 23:22:58 +00:00
|
|
|
{
|
2025-06-27 04:14:26 +00:00
|
|
|
return m_doubleTapToLock;
|
2025-06-25 23:22:58 +00:00
|
|
|
}
|
|
|
|
|
|
2025-06-27 04:14:26 +00:00
|
|
|
void HalcyonSettings::setDoubleTapToLock(bool doubleTapToLock)
|
2025-06-25 23:22:58 +00:00
|
|
|
{
|
2025-06-27 04:14:26 +00:00
|
|
|
if (m_doubleTapToLock != doubleTapToLock) {
|
|
|
|
|
m_doubleTapToLock = doubleTapToLock;
|
|
|
|
|
Q_EMIT doubleTapToLockChanged();
|
2025-06-25 23:22:58 +00:00
|
|
|
save();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HalcyonSettings::save()
|
|
|
|
|
{
|
2025-07-16 05:42:56 +00:00
|
|
|
auto group = configGroup();
|
|
|
|
|
group.writeEntry(CFG_KEY_SHOW_WALLPAPER_BLUR, (int)m_wallpaperBlurEffect);
|
|
|
|
|
group.writeEntry(CFG_KEY_DOUBLE_TAP_TO_LOCK, m_doubleTapToLock);
|
2025-06-25 23:22:58 +00:00
|
|
|
|
2025-07-16 05:42:56 +00:00
|
|
|
m_applet->config().sync();
|
2025-06-25 23:22:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HalcyonSettings::load()
|
|
|
|
|
{
|
2025-07-16 05:42:56 +00:00
|
|
|
migrateConfigFromPlasma6_4();
|
|
|
|
|
|
|
|
|
|
auto group = configGroup();
|
|
|
|
|
m_wallpaperBlurEffect = static_cast<WallpaperBlurEffect>(group.readEntry(CFG_KEY_SHOW_WALLPAPER_BLUR, (int)Full));
|
|
|
|
|
m_doubleTapToLock = group.readEntry(CFG_KEY_DOUBLE_TAP_TO_LOCK, true);
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
|
|
|
|
|
Q_EMIT doubleTapToLockChanged();
|
|
|
|
|
Q_EMIT wallpaperBlurEffectChanged();
|
|
|
|
|
}
|
2025-07-16 05:42:56 +00:00
|
|
|
|
|
|
|
|
KConfigGroup HalcyonSettings::configGroup() const
|
|
|
|
|
{
|
|
|
|
|
if (!m_applet) {
|
|
|
|
|
return KConfigGroup{};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return m_applet->config().group(CFG_GROUP_HALCYON);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HalcyonSettings::migrateConfigFromPlasma6_4()
|
|
|
|
|
{
|
|
|
|
|
// Migrate config options (from before Plasma 6.5) from the root config group to [General]
|
|
|
|
|
// When adding new config options, do not update this function!
|
|
|
|
|
|
|
|
|
|
auto oldConfigGroup = m_applet->config();
|
|
|
|
|
auto newConfigGroup = configGroup();
|
|
|
|
|
|
|
|
|
|
const QString oldKey = u"Pinned"_s;
|
|
|
|
|
if (!oldConfigGroup.hasKey(oldKey) || newConfigGroup.hasKey(CFG_KEY_PINNED)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newConfigGroup.writeEntry(CFG_KEY_PINNED, oldConfigGroup.readEntry(oldKey, u"{}"_s));
|
|
|
|
|
oldConfigGroup.deleteEntry(oldKey);
|
|
|
|
|
|
|
|
|
|
m_applet->config().sync();
|
|
|
|
|
}
|