Very early KDE 6 release.

This commit is contained in:
wackyideas 2024-08-09 03:20:25 +02:00
parent 7cc4ccabbc
commit 686046d4f7
6272 changed files with 140920 additions and 529657 deletions

View file

@ -0,0 +1,15 @@
// MidButton got deprecated and doesn't really work anymore as a stringified enum value
// for the middle button Qt::MouseButton, we need to update our config to "MiddleButton"
var plasmaConfig = ConfigFile("plasma-org.kde.plasma.desktop-appletsrc", "ActionPlugins");
for (let i in plasmaConfig.groupList) {
let subGroup = ConfigFile(plasmaConfig, plasmaConfig.groupList[i])
for (let j in subGroup.keyList) {
let key = subGroup.keyList[j];
if (key.indexOf("MidButton") !== -1) {
subGroup.writeEntry(key.replace("MidButton", "MiddleButton"), subGroup.readEntry(key));
subGroup.deleteEntry(key);
}
}
}

View file

@ -0,0 +1,53 @@
/*
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)
}
}
}
}

View file

@ -0,0 +1,21 @@
/*
SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
/**
@c showSeconds option now supports showing seconds only in the tooltip.
@see https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/2232
@since 6.0
*/
const containments = desktops().concat(panels());
containments.forEach(containment => containment.widgets("org.kde.plasma.digitalclock").forEach(widget => {
widget.currentConfigGroup = ["Appearance"];
if (widget.readConfig("showSeconds", false /* Default: never show seconds */) === true /* Changed by the user */) {
widget.writeConfig("showSeconds", 2 /* Always show seconds */);
}
}));

View file

@ -0,0 +1,23 @@
// Find all digital clock applets in all containments and change
// displayTimezoneAsCode=false
// to
// displayTimezoneFormat=FullText
// See https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/751
var containments = desktops().concat(panels());
for (var i in containments) {
var cont = containments[i];
for (var j in cont.widgetIds) {
var widget = cont.widgetById(cont.widgetIds[j]);
if (widget.type == "org.kde.plasma.digitalclock") {
widget.currentConfigGroup = new Array('Appearance')
if (widget.readConfig("displayTimezoneAsCode", true) == false) {
widget.writeConfig("displayTimezoneFormat", "FullText")
// Work around not being able to delete config file keys using widget interface
widget.writeConfig("displayTimezoneAsCode", "")
}
}
}
}

View file

@ -0,0 +1,109 @@
/* vim:set foldmethod=marker:
SPDX-FileCopyrightText: 2023 Marco Martin <mart@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
function filterDisabled(entries) {
let filteredEntries = [];
// 0 = screen, 1 = activity, 2 = how many entries, 3 = desktop entry
let state = 0;
let entriesForCurrentScreen = 0;
let currentScreen = -1;
let currentActivity = "";
let currentEntrtriesNumber = 0;
let currentEntry = 0;
let currentEntries = [];
for (let e of entries) {
switch (state) {
case 0: // Screen
currentScreen = e;
state = 1;
break;
case 1: // Activity
currentActivity = e;
state = 2;
break;
case 2: // Entries number
currentEntrtriesNumber = Number(e);
state = 3;
break;
case 3: // Desktop file
if (e.indexOf("desktop:/") !== 0) { // User has a folderview not in desktop:/
currentEntries.push(e);
currentEntry++;
} else {
let count = (e.match(/\//g) || []).length;
if (count == 1) {
currentEntries.push(e);
currentEntry++;
} else {
currentEntrtriesNumber--;
}
}
if (currentEntry === currentEntrtriesNumber) {
state = 0;
if (currentEntries.length > 0) {
filteredEntries = filteredEntries.concat([currentScreen, currentActivity, currentEntrtriesNumber]);
filteredEntries = filteredEntries.concat(currentEntries);
currentEntries = [];
}
}
break;
}
}
return filteredEntries;
}
function filterEnabled(entries) {
let filteredEntries = [];
// 0 = desktop entry, 1 = screen 2 = activity
let state = 0;
let shouldDrop = false; //true when this entry should be dropped
for (let e of entries) {
switch (state) {
case 0: // Desktop file
if (e.indexOf("desktop:/") !== 0) { // User has a folderview not in desktop:/
filteredEntries.push(e);
shouldDrop = false;
} else {
let count = (e.match(/\//g) || []).length;
if (count == 1) {
filteredEntries.push(e);
shouldDrop = false;
} else {
shouldDrop = true;
}
}
break;
case 1: // Screen
case 2: // Activity
if (!shouldDrop) {
filteredEntries.push(e);
}
}
state = (state + 1) % 3;
}
return filteredEntries;
}
const config = ConfigFile('plasma-org.kde.plasma.desktop-appletsrc');
config.group = 'ScreenMapping';
let entries = config.readEntry("itemsOnDisabledScreens").split(",");
let filteredEntries = filterDisabled(entries);
config.writeEntry("itemsOnDisabledScreens", filteredEntries.join(","));
entries = config.readEntry("screenMapping").split(",");
filteredEntries = filterEnabled(entries);
config.writeEntry("screenMapping", filteredEntries.join(","));

View file

@ -0,0 +1,33 @@
// Find all Keyboard Layout applets in all containments and change
// showFlag=true
// to
// displayStyle=Flag
// See https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1131
const containments = desktops().concat(panels());
for (var i in containments) {
forEachWidgetInContainment(containments[i]);
}
function forEachWidgetInContainment(containment) {
const widgets = containment.widgets();
for (var i in widgets) {
const widget = widgets[i];
switch(widget.type) {
case "org.kde.plasma.systemtray":
systemtrayId = widget.readConfig("SystrayContainmentId");
if (systemtrayId) {
forEachWidgetInContainment(desktopById(systemtrayId))
}
break;
case "org.kde.plasma.keyboardlayout":
widget.currentConfigGroup = new Array('General')
if (widget.readConfig("showFlag", false) == true) {
widget.writeConfig("displayStyle", "Flag")
// Work around not being able to delete config file keys using widget interface
widget.writeConfig("showFlag", "")
}
break;
}
}
}

View file

@ -0,0 +1,25 @@
const containments = desktops().concat(panels());
for (var i in containments) {
forEachWidgetInContainment(containments[i]);
}
function forEachWidgetInContainment(containment) {
const widgets = containment.widgets();
for (var i in widgets) {
const widget = widgets[i];
switch(widget.type) {
case "org.kde.plasma.systemtray":
systemtrayId = widget.readConfig("SystrayContainmentId");
if (systemtrayId) {
forEachWidgetInContainment(desktopById(systemtrayId))
}
break;
case "org.kde.plasma.keyboardlayout":
if (widget.globalShortcut) {
print("Shortcut to remove: " + widget.globalShortcut);
widget.globalShortcut = "";
}
break;
}
}
}

View file

@ -0,0 +1,14 @@
/*
Previously, Klipper "clear history" dialog used to not ask again even if user answered No.
This was changed so that only a Yes answer will lead to no more asking, by using warningContinueCancel instead of questionYesNo.
Now the behaviour of previous config value really_clear_history has inverted: true/undefined => ask again; false => don't ask.
This update script migrates old configs to use the new config value, renamed to klipperClearHistoryAskAgain.
*/
config = ConfigFile("plasmashellrc", "Notification Messages");
oldVal = config.readEntry("really_clear_history");
if (oldVal === "true") {
// Clear and don't ask again -- preserve this choice
config.writeEntry("klipperClearHistoryAskAgain", false)
}
config.deleteEntry("really_clear_history");

View file

@ -0,0 +1,46 @@
// This script updates users' Folder View icon sizes following a change in what
// they mean in https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/111
var allDesktops = desktops();
for (var i = 0; i < allDesktops.length; ++i) {
var desktop = allDesktops[i];
desktop.currentConfigGroup = ["General"];
var currentIconSize = desktop.readConfig("iconSize");
// Don't do anything if there is no value in the config file, since in this
// case, no change is needed because the new default works properly
if (currentIconSize) {
currentIconSize = parseInt(currentIconSize);
// No change needed for iconSize=0 or 5
if (currentIconSize != 0 && currentIconSize != 5) {
print("Current icon size is " + currentIconSize);
var newIconSize = 3;
switch(currentIconSize) {
case 1:
newIconSize = 0;
break;
case 2:
newIconSize = 1;
break;
case 3:
newIconSize = 2;
break;
case 4:
newIconSize = 3;
break;
// We should never reach here, but in case we do anyway, reset to
// the default value
default:
break;
}
desktop.writeConfig("iconSize", newIconSize);
desktop.reloadConfig()
}
}
}

View file

@ -0,0 +1,23 @@
/*
SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
/**
The Media Frame widget removes the useBackground option and uses ConfigurableBackground
hint to support toggling the background directly from the widget toolbar.
The option only applies to media frame widgets on desktop.
@see https://invent.kde.org/plasma/kdeplasma-addons/-/merge_requests/238
@since 5.27
*/
desktops().forEach(containment => containment.widgets("org.kde.plasma.mediaframe").forEach(widget => {
widget.currentConfigGroup = ["General"];
if (widget.readConfig("useBackground", true /* Default */) === false /* Changed by the user */) {
widget.writeConfig("useBackground", "");
widget.currentConfigGroup = []; // Root Configuration
widget.writeConfig("UserBackgroundHints", "NoBackground");
}
}));

View file

@ -0,0 +1,44 @@
/*
SPDX-FileCopyrightText: 2023 Akseli Lahtinen <akselmo@akselmo.dev>
SPDX-License-Identifier: GPL-2.0-or-later
*/
// Find all depicted widgets and migrate their font weights from qt5 to qt6 style
var containments = desktops().concat(panels());
for (var c in containments) {
const cont = containments[c];
const widgets = cont.widgets();
for (var w in widgets) {
var widget = widgets[w];
switch(widget.type) {
case "org.kde.plasma.digitalclock":
widget.currentConfigGroup = ['Appearance'];
// Use "normal" weight as default if weight is not set
const oldFontWeight = widget.readConfig("fontWeight", 400);
const newFontWeight = migrateFontWeight(Number(oldFontWeight));
widget.writeConfig("fontWeight", newFontWeight);
break;
}
}
}
function migrateFontWeight(oldWeight) {
// Takes old weight (Qt5 weight) and returns the Qt6 equivalent
// Qt5 font weights: https://doc.qt.io/qt-5/qfont.html#Weight-enum
// Qt6 font weights: https://doc.qt.io/qt-6/qfont.html#Weight-enum
var newWeight = 400;
if (oldWeight === 0) { newWeight = 100; }
else if (oldWeight === 12) { newWeight = 200; }
else if (oldWeight === 25) { newWeight = 300; }
else if (oldWeight === 50) { newWeight = 400; }
else if (oldWeight === 57) { newWeight = 500; }
else if (oldWeight === 63) { newWeight = 600; }
else if (oldWeight === 75) { newWeight = 700; }
else if (oldWeight === 81) { newWeight = 800; }
else if (oldWeight === 87) { newWeight = 900; }
return newWeight;
}

View file

@ -0,0 +1,10 @@
var allDesktops = desktops();
for (var i = 0; i < allDesktops.length; ++i) {
var desktop = allDesktops[i];
desktop.currentConfigGroup = ["General"];
var serializedItems = desktop.readConfig("ItemsGeometries");
desktop.currentConfigGroup = [];
desktop.writeConfig("ItemGeometriesHorizontal", serializedItems);
desktop.reloadConfig()
}

View file

@ -0,0 +1,26 @@
// In the past, panels were configured to add a note on middle-click. This was changed,
// but the "MiddleButton;NoModifier=org.kde.paste" action was never removed from the
// config file, so some people still got this undesirable behavior with no GIU method
// to change it.
//
// This script removes it.
var plasmaConfig = ConfigFile("plasma-org.kde.plasma.desktop-appletsrc", "ActionPlugins");
for (let i in plasmaConfig.groupList) {
let subSubGroupKeys = [];
let subGroup = ConfigFile(plasmaConfig, plasmaConfig.groupList[i]);
for (let j in subGroup.groupList) {
let subSubGroup = ConfigFile(subGroup, subGroup.groupList[j]);
subSubGroupKeys = subSubGroup.keyList;
}
if (subSubGroupKeys.indexOf("_sep1") === -1) {
print("Containment " + i + " Does not have a _sep1 item; it must be a panel.\n");
// No _sep1 item; this must be a panel
let mmbAction = subGroup.readEntry("MiddleButton;NoModifier");
if (mmbAction === "org.kde.paste") {
print("Panel " + i + " Seems to have a middle-click paste action defined; deleting it!");
subGroup.deleteEntry("MiddleButton;NoModifier");
}
}
}

View file

@ -0,0 +1,39 @@
function swapWidget(cont, oldWidget, newType, geometry) {
oldWidget.remove();
cont.addWidget(newType, geometry.x, geometry.y, geometry.width, geometry.height);
}
var containments = desktops().concat(panels());
for (var i in containments) {
var cont = containments[i];
for (var j in cont.widgetIds) {
var widget = cont.widgetById(cont.widgetIds[j]);
let newType = ""
if (widget.type == "org.kde.plasma.systemloadviewer") {
let geometry = widget.geometry;
geometry.width = geometry.width/3
widget.remove();
cont.addWidget("org.kde.plasma.systemmonitor.cpuusage", geometry.x, geometry.y, geometry.width, geometry.height);
geometry.x += geometry.width;
cont.addWidget("org.kde.plasma.systemmonitor.memoryusage", geometry.x, geometry.y, geometry.width, geometry.height);
geometry.x += geometry.width;
let swapWidget = cont.addWidget("org.kde.plasma.systemmonitor", geometry.x, geometry.y, geometry.width, geometry.height);
swapWidget.currentConfigGroup = ["Appearance"];
swapWidget.writeConfig("title", "Swap");
swapWidget.currentConfigGroup = ["Sensors"];
swapWidget.writeConfig("highPrioritySensorIds", "[\"mem/swap/used\",\"mem/swap/free\"]");
swapWidget.writeConfig("totalSensors", "[\"mem/swap/used\"]");
swapWidget.currentConfigGroup = ["SensorColors"];
swapWidget.writeConfig("mem/swap/free", "230,230,230");
swapWidget.reloadconfiguration();
}
}
}

View file

@ -0,0 +1,2 @@
__AppInterface.locked = false;