aerothemeplasma/plasma/shells/io.gitgud.wackyideas.desktop/contents/updates/folderview_fix_recursive_screenmapping.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

109 lines
3.2 KiB
JavaScript

/* 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(","));