aerothemeplasma/plasma/shells/io.gitgud.wackyideas.desktop/contents/updates/digitalclock_migrate_font_settings.js
wackyideas 6f831d540f Move to new shell plugin & panel, add SDDM sessions
This is a big update which requires existing users to migrate their
desktop setup (Plasmoids, their configurations, layout changes, etc.) to
a new desktop session.

This commit replaces the modified desktop shell (org.kde.plasma.desktop)
with ATP's shell (io.gitgud.wackyideas.desktop) which requires new
session options. This is similar to how plasma-bigscreen and
plasma-mobile are used - logging into a separate session via the login
manager (SDDM). ATP will provide sessions for both X11 and Wayland.

This, along with now providing a forked panel as well, is a step forward
regarding separating ATP's codebase and KDE's upstream code. Further
goals are to be able to further isolate the ATP session from the regular
KDE session in terms of shared configurations, etc.

For existing users - Rerun install_plasmoids.sh and
install_plasma_components.sh, you can delete the old shell
(shells/org.kde.plasma.desktop) and panel plasmoid
(plasmoids/org.kde.panel). As mentioned previously, panel and desktop
layouts, plasmoids and their configurations will not be migrated to the
newly available sessions, so they need to be set up manually.
2025-10-21 13:23:06 +02:00

53 lines
2.2 KiB
JavaScript

/*
SPDX-FileCopyrightText: 2022 Jin Liu <ad.liu.jin@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
/*
Plasma 5.26 introduced a new config entry autoFontAndSize which defaults to true.
This means if the user customized font before (fontFamily, boldText, italicText),
in 5.26 these settings are ignored.
So we need to set autoFontAndSize=false if:
1. Any of these 3 old entries above is set.
2. No new entries introduced in 5.26 (autoFontAndSize, fontSize, fontWeight, fontStyleName)
are set, so this is a config from 5.25.
And fontWeight should be set to 75 (Font.Bold) if boldText==true.
See https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1809
*/
const containments = desktops().concat(panels());
for (var i in containments) {
var cont = containments[i];
const widgets = cont.widgets();
for (var j in widgets) {
var widget = widgets[j];
if (widget.type == "org.kde.plasma.digitalclock") {
widget.currentConfigGroup = new Array('Appearance')
if ((widget.readConfig("fontFamily", "").length > 0
|| widget.readConfig("boldText", false)
|| widget.readConfig("italicText", false))
&&
(widget.readConfig("autoFontAndSize", true)
&& widget.readConfig("fontSize", 10) === 10
&& widget.readConfig("fontWeight", 50) === 50
&& widget.readConfig("fontStyleName", "").length === 0)) {
widget.writeConfig("autoFontAndSize", false)
if (widget.readConfig("boldText", false)) {
widget.writeConfig("fontWeight", 75)
}
// Set the font size to the largest value (72) in the font dialog,
// so the font autofits the panel when the panel height is less
// than 72pt. This should keep 5.25's autosize behavior for custom
// font.
// For panels taller than 72pt, with custom font set in 5.25, the
// digital clock's look may still change, though.
widget.writeConfig("fontSize", 72)
}
}
}
}