aerothemeplasma/plasma/shells/io.gitgud.wackyideas.desktop/contents/activitymanager/ActivityList.qml
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

198 lines
5.2 KiB
QML

/* vim:set foldmethod=marker:
SPDX-FileCopyrightText: 2014 Ivan Cukic <ivan.cukic(at)kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick
import org.kde.kirigami 2.20 as Kirigami
import org.kde.activities 0.1 as Activities
import org.kde.plasma.activityswitcher as ActivitySwitcher
Flickable {
id: root
// contentWidth: content.width
contentHeight: content.height
property var model: ActivitySwitcher.Backend.runningActivitiesModel()
property string filterString: ""
property bool showSwitcherOnly: false
property int itemsWidth: 0
property int selectedIndex: -1
function _selectRelativeToCurrent(distance)
{
var startingWithSelected = selectedIndex;
do {
selectedIndex += distance;
if (selectedIndex >= activitiesList.count) {
selectedIndex = 0;
}
if (selectedIndex < 0) {
selectedIndex = activitiesList.count - 1;
}
// Searching for the first item that is visible, or back to the one
// that we started with
} while (!activitiesList.itemAt(selectedIndex).visible
&& startingWithSelected !== selectedIndex);
_updateSelectedItem();
}
function selectNext()
{
_selectRelativeToCurrent(1);
}
function selectPrevious()
{
_selectRelativeToCurrent(-1);
}
function _updateSelectedItem()
{
for (var i = 0; i < activitiesList.count; i++) {
activitiesList.itemAt(i).selected = (i === selectedIndex);
}
}
function openSelected()
{
var selectedItem = null;
if (selectedIndex >= 0 && selectedIndex < activitiesList.count) {
selectedItem = activitiesList.itemAt(selectedIndex);
} else if (root.filterString != "") {
// If we have only one item shown, activate it. It doesn't matter
// that it is not really selected
for (var i = 0; i < activitiesList.count; i++) {
var item = activitiesList.itemAt(i);
if (item.visible) {
selectedItem = item;
break;
}
}
}
if (selectedItem !== null) {
ActivitySwitcher.Backend.setCurrentActivity(selectedItem.activityId);
}
}
Column {
id: content
padding: Kirigami.Units.smallSpacing
// width: root.width - (root.width % 10)
width: root.itemsWidth
spacing: Kirigami.Units.smallSpacing * 2
// Running activities
Repeater {
id: activitiesList
model: ActivitySwitcher.Backend.runningActivitiesModel()
ActivityItem {
width: content.width
visible : (root.filterString == "") ||
(title.toLowerCase().indexOf(root.filterString) != -1)
activityId : model.id
title : model.name
icon : model.iconSource
background : model.background
current : model.isCurrent
hasWindows : model.hasWindows
innerPadding : 2 * Kirigami.Units.smallSpacing
stoppable : activitiesList.count > 1
onClicked : {
ActivitySwitcher.Backend.setCurrentActivity(model.id);
}
}
}
// Stopped activities
Item {
// spacer
width : parent.width
height : Kirigami.Units.gridUnit
}
Kirigami.Heading {
id: stoppedActivitiesHeading
text: i18nd("plasma_shell_org.kde.plasma.desktop", "Stopped activities:")
textFormat: Text.PlainText
level: 3
visible: !root.showSwitcherOnly && stoppedActivitiesList.count > 0
}
Repeater {
id: stoppedActivitiesList
model: root.showSwitcherOnly ? null : ActivitySwitcher.Backend.stoppedActivitiesModel()
delegate: StoppedActivityItem {
id: stoppedActivityItem
width: parent.width
visible : (root.filterString == "") ||
(title.toLowerCase().indexOf(root.filterString) != -1)
activityId : model.id
title : model.name
icon : model.iconSource
innerPadding : 2 * Kirigami.Units.smallSpacing
onClicked: {
ActivitySwitcher.Backend.setCurrentActivity(model.id)
}
}
}
Item {
// spacer
width : parent.width
height : Kirigami.Units.gridUnit * 2
visible: stoppedActivitiesHeading.visible
}
add: Transition {
NumberAnimation {
properties: "x"
from: -100
duration: Kirigami.Units.shortDuration
}
}
move: Transition {
NumberAnimation {
id: animation
properties: "y"
duration: Kirigami.Units.longDuration
}
}
}
}