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,10 @@
import QtQuick 2.15
import org.kde.plasma.configuration
ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "preferences-desktop-color"
source: "config/ConfigGeneral.qml"
}
}

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="click_action" type="string">
<default>run_command</default>
</entry>
<entry name="click_command" type="string">
<default>qdbus6 org.kde.kglobalaccel /component/kwin invokeShortcut "MinimizeAll"</default>
</entry>
<entry name="mousewheel_action" type="string">
<default>run_commands</default>
</entry>
<entry name="mousewheel_up" type="string">
<default>qdbus6 org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume"</default>
</entry>
<entry name="mousewheel_down" type="string">
<default>qdbus6 org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume"</default>
</entry>
<entry name="size" type="int">
<default>9</default>
</entry>
<entry name="peekingEnabled" type="bool">
<default>true</default>
</entry>
<entry name="peekingThreshold" type="int">
<default>750</default>
</entry>
<entry name="edgeColor" type="string">
<default></default>
</entry>
<entry name="hoveredColor" type="string">
<default></default>
</entry>
<entry name="pressedColor" type="string">
<default></default>
</entry>
</group>
</kcfg>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,19 @@
import QtQuick 2.15
import org.kde.kirigami as Kirigami
import org.kde.plasma.plasmoid
QtObject {
id: config
// Colors
function alpha(c, newAlpha) {
return Qt.rgba(c.r, c.g, c.b, newAlpha)
}
property color defaultEdgeColor: alpha(Kirigami.Theme.textColor, 0.4)
property color defaultHoveredColor: Kirigami.Theme.backgroundColor
property color defaultPressedColor: Kirigami.Theme.hoverColor
property color edgeColor: Plasmoid.configuration.edgeColor || defaultEdgeColor
property color hoveredColor: Plasmoid.configuration.hoveredColor || defaultHoveredColor
property color pressedColor: Plasmoid.configuration.pressedColor || defaultPressedColor
}

View file

@ -0,0 +1,25 @@
/*
SPDX-FileCopyrightText: 2022 ivan (@ratijas) tkachenko <me@ratijas.tk>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import org.kde.plasma.plasmoid 2.0
Controller {
id: controller
titleInactive: i18nc("@action:button", "Run custom command")
titleActive: titleInactive
descriptionActive: i18nc("@info:tooltip", "Run user-defined command when pressed")
descriptionInactive: descriptionActive
active: false
// override
function toggle() {
root.exec(Plasmoid.configuration.click_command);
}
}

View file

@ -0,0 +1,26 @@
/*
SPDX-FileCopyrightText: 2022 ivan (@ratijas) tkachenko <me@ratijas.tk>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQml 2.15
QtObject {
/**
* Whether the effect is currently active, and can be deactivated.
*/
property bool active
property string titleActive
property string titleInactive
property string descriptionActive
property string descriptionInactive
readonly property string title: active ? titleActive : titleInactive
readonly property string description: active ? descriptionActive : descriptionInactive
// virtual
function toggle() {}
}

View file

@ -0,0 +1,93 @@
/*
SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
SPDX-FileCopyrightText: 2016 Anthony Fieroni <bvbfan@abv.bg>
SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org>
SPDX-FileCopyrightText: 2022 ivan (@ratijas) tkachenko <me@ratijas.tk>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQml 2.15
import org.kde.taskmanager 0.1 as TaskManager
Controller {
id: controller
titleActive: i18nc("@action:button", "Restore All Minimized Windows")
titleInactive: i18nc("@action:button", "Minimize All Windows")
descriptionActive: i18nc("@info:tooltip", "Restores the previously minimized windows")
descriptionInactive: i18nc("@info:tooltip", "Shows the Desktop by minimizing all windows")
readonly property QtObject tasksModel: TaskManager.TasksModel {
id: tasksModel
sortMode: TaskManager.TasksModel.SortDisabled
groupMode: TaskManager.TasksModel.GroupDisabled
}
readonly property Connections activeTaskChangedConnection: Connections {
target: tasksModel
enabled: controller.active
function onActiveTaskChanged() {
if (tasksModel.activeTask.valid) { // to suppress changing focus to non windows, such as the desktop
controller.active = false;
controller.minimizedClients = [];
}
}
function onVirtualDesktopChanged() {
controller.deactivate();
}
function onActivityChanged() {
controller.deactivate();
}
}
/**
* List of persistent model indexes from task manager model of
* clients minimized by us
*/
property var minimizedClients: []
function activate() {
const clients = [];
for (let i = 0; i < tasksModel.count; i++) {
const idx = tasksModel.makeModelIndex(i);
if (!tasksModel.data(idx, TaskManager.AbstractTasksModel.IsHidden)) {
tasksModel.requestToggleMinimized(idx);
clients.push(tasksModel.makePersistentModelIndex(i));
}
}
minimizedClients = clients;
active = true;
}
function deactivate() {
active = false;
for (let i = 0; i < minimizedClients.length; i++) {
const idx = minimizedClients[i];
// client deleted, do nothing
if (!idx.valid) {
continue;
}
// if the user has restored it already, do nothing
if (!tasksModel.data(idx, TaskManager.AbstractTasksModel.IsHidden)) {
continue;
}
tasksModel.requestToggleMinimized(idx);
}
minimizedClients = [];
}
// override
function toggle() {
if (active) {
deactivate();
} else {
activate();
}
}
}

View file

@ -0,0 +1,30 @@
/*
SPDX-FileCopyrightText: 2022 ivan (@ratijas) tkachenko <me@ratijas.tk>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import org.kde.plasma.private.showdesktop 0.1
import org.kde.plasma.plasmoid 2.0
Controller {
id: controller
titleInactive: i18nc("@action:button", "Peek at Desktop")
titleActive: Plasmoid.containment.corona.editMode ? titleInactive : i18nc("@action:button", "Stop Peeking at Desktop")
descriptionActive: i18nc("@info:tooltip", "Moves windows back to their original positions")
descriptionInactive: i18nc("@info:tooltip", "Temporarily shows the desktop by moving windows away")
active: showdesktop.showingDesktop
// override
function toggle() {
showdesktop.toggleDesktop();
}
readonly property ShowDesktop showdesktop: ShowDesktop {
id: showdesktop
}
}

View file

@ -0,0 +1,224 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.1
import org.kde.kirigami as Kirigami
import ".."
import "../lib"
ConfigPage {
id: page
showAppletVersion: true
property string cfg_click_action: 'showdesktop'
property alias cfg_click_command: click_command.text
property string cfg_mousewheel_action: 'run_commands'
property alias cfg_mousewheel_up: mousewheel_up.text
property alias cfg_mousewheel_down: mousewheel_down.text
property bool showDebug: false
property int indentWidth: 24
AppletConfig {
id: config
}
function setClickCommand(command) {
cfg_click_action = 'run_command'
clickGroup_runcommand.checked = true
cfg_click_command = command
}
function setMouseWheelCommands(up, down) {
cfg_mousewheel_action = 'run_commands'
mousewheelGroup_runcommands.checked = true
cfg_mousewheel_up = up
cfg_mousewheel_down = down
}
ConfigSection {
title: i18n("Look")
Kirigami.FormLayout {
Layout.fillWidth: true
ConfigSpinBox {
Kirigami.FormData.label: i18n("Size:")
configKey: 'size'
suffix: i18n("px")
}
ConfigColor {
Kirigami.FormData.label: i18n("Edge Color:")
configKey: "edgeColor"
defaultColor: config.defaultEdgeColor
label: ""
}
ConfigColor {
Kirigami.FormData.label: i18n("Hovered Color:")
configKey: "hoveredColor"
defaultColor: config.defaultHoveredColor
label: ""
}
ConfigColor {
Kirigami.FormData.label: i18n("Pressed Color:")
configKey: "pressedColor"
defaultColor: config.defaultPressedColor
label: ""
}
}
}
ButtonGroup { id: clickGroup }
ConfigSection {
title: i18n("Click")
RadioButton {
ButtonGroup.group: clickGroup
checked: cfg_click_action == 'showdesktop'
text: i18nd("plasma_applet_org.kde.plasma.showdesktop", "Show Desktop")
onClicked: {
cfg_click_action = 'showdesktop'
}
}
RadioButton {
ButtonGroup.group: clickGroup
checked: cfg_click_action == 'minimizeall'
text: i18ndc("plasma_applet_org.kde.plasma.showdesktop", "@action", "Minimize All Windows")
onClicked: {
cfg_click_action = 'minimizeall'
}
}
RadioButton {
id: clickGroup_runcommand
ButtonGroup.group: clickGroup
checked: cfg_click_action == 'run_command'
text: i18n("Run Command")
onClicked: {
cfg_click_action = 'run_command'
}
}
RowLayout {
Layout.fillWidth: true
Text { width: indentWidth } // indent
TextField {
Layout.fillWidth: true
id: click_command
}
}
RadioButton {
ButtonGroup.group: clickGroup
checked: false
text: i18nd("kwin_effects", "Toggle Present Windows (All desktops)")
property string command: 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "ExposeAll"'
onClicked: setClickCommand(command)
}
RadioButton {
ButtonGroup.group: clickGroup
checked: false
text: i18nd("kwin_effects", "Toggle Present Windows (Current desktop)")
property string command: 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Expose"'
onClicked: setClickCommand(command)
}
RadioButton {
ButtonGroup.group: clickGroup
checked: false
text: i18nd("kwin_effects", "Toggle Present Windows (Window class)")
property string command: 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "ExposeClass"'
onClicked: setClickCommand(command)
}
}
ButtonGroup { id: mousewheelGroup }
ConfigSection {
title: i18n("Mouse Wheel")
RadioButton {
id: mousewheelGroup_runcommands
ButtonGroup.group: mousewheelGroup
checked: cfg_mousewheel_action == 'run_commands'
text: i18n("Run Commands")
onClicked: {
cfg_mousewheel_action = 'run_commands'
}
}
RowLayout {
Layout.fillWidth: true
Text { width: indentWidth } // indent
Label {
text: i18n("Scroll Up:")
}
TextField {
Layout.fillWidth: true
id: mousewheel_up
}
}
RowLayout {
Layout.fillWidth: true
Text { width: indentWidth } // indent
Label {
text: i18n("Scroll Down:")
}
TextField {
Layout.fillWidth: true
id: mousewheel_down
}
}
RadioButton {
ButtonGroup.group: mousewheelGroup
checked: false
text: i18n("Volume (No UI) (amixer)")
onClicked: setMouseWheelCommands('amixer -q sset Master 10%+', 'amixer -q sset Master 10%-')
}
RadioButton {
ButtonGroup.group: mousewheelGroup
checked: false
text: i18n("Volume (UI) (qdbus)")
property string upCommand: 'qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume"'
property string downCommand: 'qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume"'
onClicked: setMouseWheelCommands(upCommand, downCommand)
}
RadioButton {
ButtonGroup.group: mousewheelGroup
checked: false
text: i18n("Switch Desktop (qdbus)")
property string upCommand: 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Switch One Desktop to the Left"'
property string downCommand: 'qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Switch One Desktop to the Right"'
onClicked: setMouseWheelCommands(upCommand, downCommand)
}
}
ConfigSection {
title: i18n("Peek")
Kirigami.FormLayout {
Layout.fillWidth: true
ConfigCheckBox {
Kirigami.FormData.label: i18n("Show desktop on hover:")
configKey: "peekingEnabled"
text: i18n("Enable")
}
ConfigSpinBox {
Kirigami.FormData.label: i18n("Peek threshold:")
configKey: 'peekingThreshold'
suffix: i18n("ms")
stepSize: 50
from: 0
}
}
}
}

View file

@ -0,0 +1,50 @@
import QtQuick 2.15
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3
import org.kde.plasma.plasma5support as Plasma5Support
import org.kde.plasma.plasmoid
Item {
implicitWidth: label.implicitWidth
implicitHeight: label.implicitHeight
property string version: "?"
property string metadataFilepath: Plasmoid.file("", "../metadata.desktop")
Plasma5Support.DataSource {
id: executable
engine: "executable"
connectedSources: []
onNewData: {
var exitCode = data["exit code"]
var exitStatus = data["exit status"]
var stdout = data["stdout"]
var stderr = data["stderr"]
exited(exitCode, exitStatus, stdout, stderr)
disconnectSource(sourceName) // cmd finished
}
function exec(cmd) {
connectSource(cmd)
}
signal exited(int exitCode, int exitStatus, string stdout, string stderr)
}
Connections {
target: executable
function onExited() {
version = stdout.replace('\n', ' ').trim()
}
}
Label {
id: label
text: i18n("<b>Version:</b> %1", version)
}
Component.onCompleted: {
var cmd = 'kreadconfig6 --file "' + metadataFilepath + '" --group "Desktop Entry" --key "X-KDE-PluginInfo-Version"'
executable.exec(cmd)
}
}

View file

@ -0,0 +1,18 @@
import QtQuick 2.15
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components as PlasmaComponents
import org.kde.plasma.plasmoid
import ".."
CheckBox {
id: configCheckBox
property string configKey: ''
checked: Plasmoid.configuration[configKey]
onClicked: Plasmoid.configuration[configKey] = !Plasmoid.configuration[configKey]
}

View file

@ -0,0 +1,110 @@
import QtQuick 2.15
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3
import QtQuick.Dialogs
import QtQuick.Window 2.12
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components as PlasmaComponents
import org.kde.kirigami as Kirigami
import org.kde.plasma.plasmoid
import ".."
RowLayout {
id: configColor
spacing: 2
// Layout.fillWidth: true
Layout.maximumWidth: 300
property alias label: label.text
property alias horizontalAlignment: label.horizontalAlignment
property string configKey: ''
property string defaultColor: ''
property string value: {
if (configKey) {
return Plasmoid.configuration[configKey]
} else {
return "#000"
}
}
readonly property color defaultColorValue: defaultColor
readonly property color valueColor: {
if (value == '' && defaultColor) {
return defaultColor
} else {
return value
}
}
onValueChanged: {
if (!textField.activeFocus) {
textField.text = configColor.value
}
if (configKey) {
if (value == defaultColorValue) {
Plasmoid.configuration[configKey] = ""
} else {
Plasmoid.configuration[configKey] = value
}
}
}
function setValue(newColor) {
textField.text = newColor
}
Label {
id: label
text: "Label"
Layout.fillWidth: horizontalAlignment == Text.AlignRight
horizontalAlignment: Text.AlignLeft
}
MouseArea {
id: mouseArea
width: textField.height
height: textField.height
hoverEnabled: true
onClicked: dialog.open()
Rectangle {
anchors.fill: parent
color: configColor.valueColor
border.width: 2
border.color: parent.containsMouse ? Kirigami.Theme.highlightColor : "#BB000000"
}
}
TextField {
id: textField
placeholderText: defaultColor ? defaultColor : "#AARRGGBB"
Layout.fillWidth: label.horizontalAlignment == Text.AlignLeft
onTextChanged: {
// Make sure the text is:
// Empty (use default)
// or #123 or #112233 or #11223344 before applying the color.
if (text.length === 0
|| (text.indexOf('#') === 0 && (text.length == 4 || text.length == 7 || text.length == 9))
) {
configColor.value = text
}
}
}
ColorDialog {
id: dialog
visible: false
modality: Qt.WindowModal
title: configColor.label
flags: ColorDialog.ShowAlphaChannel
selectedColor: configColor.valueColor
onAccepted: {
configColor.value = selectedColor
}
}
}

View file

@ -0,0 +1,39 @@
// Version 4
import QtQuick 2.15
import QtQuick.Layouts 1.3
import org.kde.kcmutils as KCM
KCM.SimpleKCM {
id: page
Layout.fillWidth: true
default property alias _contentChildren: content.data
implicitHeight: content.implicitHeight
ColumnLayout {
id: content
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
// Workaround for crash when using default on a Layout.
// https://bugreports.qt.io/browse/QTBUG-52490
// Still affecting Qt 5.7.0
Component.onDestruction: {
while (children.length > 0) {
children[children.length - 1].parent = page
}
}
}
property alias showAppletVersion: appletVersionLoader.active
Loader {
id: appletVersionLoader
active: false
visible: active
source: "AppletVersion.qml"
anchors.right: parent.right
anchors.bottom: parent.top
}
}

View file

@ -0,0 +1,24 @@
import QtQuick 2.15
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3
GroupBox {
id: configSection
Layout.fillWidth: true
default property alias _contentChildren: content.data
ColumnLayout {
id: content
anchors.left: parent.left
anchors.right: parent.right
// Workaround for crash when using default on a Layout.
// https://bugreports.qt.io/browse/QTBUG-52490
// Still affecting Qt 5.7.0
Component.onDestruction: {
while (children.length > 0) {
children[children.length - 1].parent = configSection
}
}
}
}

View file

@ -0,0 +1,54 @@
import QtQuick 2.15
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3
import org.kde.plasma.plasmoid
RowLayout {
id: configSpinBox
property string configKey: ''
property alias to: spinBox.to
property alias from: spinBox.from
property alias prefix: spinBox.prefix
property alias stepSize: spinBox.stepSize
property alias suffix: spinBox.suffix
property alias value: spinBox.value
property alias before: labelBefore.text
property alias after: labelAfter.text
Label {
id: labelBefore
text: ""
visible: text
}
SpinBox {
id: spinBox
property string prefix
property string suffix
value: Plasmoid.configuration[configKey]
// onValueChanged: Plasmoid.configuration[configKey] = value
onValueChanged: serializeTimer.start()
to: 2147483647
textFromValue: function(value) {
return prefix + value + suffix;
}
}
Label {
id: labelAfter
text: ""
visible: text
}
Timer { // throttle
id: serializeTimer
interval: 300
onTriggered: Plasmoid.configuration[configKey] = value
}
}

View file

@ -0,0 +1,320 @@
/*
SPDX-FileCopyrightText: 2014 Ashish Madeti <ashishmadeti@gmail.com>
SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-FileCopyrightText: 2019 Chris Holland <zrenfire@gmail.com>
SPDX-FileCopyrightText: 2022 ivan (@ratijas) tkachenko <me@ratijas.tk>
SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Layouts 1.3
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasma5support as Plasma5Support
import org.kde.kirigami as Kirigami
import org.kde.ksvg as KSvg
import org.kde.plasma.plasmoid
PlasmoidItem {
id: root
preferredRepresentation: fullRepresentation
toolTipSubText: activeController.description
Plasmoid.icon: "transform-move"
Plasmoid.title: activeController.title
Plasmoid.onActivated: {
peekTimer.stop();
if (isPeeking) {
isPeeking = false;
if(peekController.active)
peekController.toggle();
}
activeController.toggle();
}
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
Layout.minimumWidth: Kirigami.Units.iconSizes.medium
Layout.minimumHeight: Kirigami.Units.iconSizes.medium
Layout.maximumWidth: vertical ? Layout.minimumWidth : Math.max(1, Plasmoid.configuration.size)
Layout.maximumHeight: vertical ? Math.max(1, Plasmoid.configuration.size) : Layout.minimumHeight
Layout.preferredWidth: Layout.maximumWidth
Layout.preferredHeight: Layout.maximumHeight
Plasmoid.constraintHints: Plasmoid.CanFillArea
readonly property bool inPanel: [PlasmaCore.Types.TopEdge, PlasmaCore.Types.RightEdge, PlasmaCore.Types.BottomEdge, PlasmaCore.Types.LeftEdge]
.includes(Plasmoid.location)
readonly property bool vertical: Plasmoid.location === PlasmaCore.Types.RightEdge || Plasmoid.location === PlasmaCore.Types.LeftEdge
readonly property Controller primaryController: {
if (Plasmoid.configuration.click_action == "minimizeall") {
return minimizeAllController;
} else if (Plasmoid.configuration.click_action == "showdesktop") {
return peekController;
} else {
return commandController;
}
}
readonly property Controller activeController: {
return primaryController;
if (minimizeAllController.active) {
return minimizeAllController;
} else {
return primaryController;
}
}
property bool isPeeking: false
MouseArea {
id: mouseArea
anchors.fill: parent
anchors.rightMargin: -Kirigami.Units.smallSpacing - Kirigami.Units.smallSpacing/2;
activeFocusOnTab: true
hoverEnabled: true
onClicked: Plasmoid.activated();
onEntered: {
if (Plasmoid.configuration.peekingEnabled)
peekTimer.start();
}
onExited: {
peekTimer.stop();
if (isPeeking) {
isPeeking = false;
if(peekController.active)
peekController.toggle();
}
}
// org.kde.plasma.volume
property int wheelDelta: 0
onWheel: wheel => {
const delta = (wheel.inverted ? -1 : 1) * (wheel.angleDelta.y ? wheel.angleDelta.y : -wheel.angleDelta.x);
wheelDelta += delta;
// Magic number 120 for common "one click"
// See: https://qt-project.org/doc/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop
while (wheelDelta >= 120) {
wheelDelta -= 120;
performMouseWheelUp();
}
while (wheelDelta <= -120) {
wheelDelta += 120;
performMouseWheelDown();
}
}
Keys.onPressed: {
switch (event.key) {
case Qt.Key_Space:
case Qt.Key_Enter:
case Qt.Key_Return:
case Qt.Key_Select:
Plasmoid.activated();
break;
}
}
Accessible.name: Plasmoid.title
Accessible.description: toolTipSubText
Accessible.role: Accessible.Button
PeekController {
id: peekController
}
MinimizeAllController {
id: minimizeAllController
}
CommandController {
id: commandController
}
Kirigami.Icon {
anchors.fill: parent
active: mouseArea.containsMouse || activeController.active
visible: Plasmoid.containment.corona.editMode
source: Plasmoid.icon
}
// also activate when dragging an item over the plasmoid so a user can easily drag data to the desktop
DropArea {
anchors.fill: parent
onEntered: activateTimer.start()
onExited: activateTimer.stop()
}
Timer {
id: activateTimer
interval: 250 // to match TaskManager
onTriggered: Plasmoid.activated()
}
Timer {
id: peekTimer
interval: Plasmoid.configuration.peekingThreshold
onTriggered: {
if (!minimizeAllController.active && !peekController.active) {
isPeeking = true;
peekController.toggle();
}
}
}
state: {
if (mouseArea.containsPress) {
return "selected";
} else if (mouseArea.containsMouse || mouseArea.activeFocus) {
return "hover";
} else {
return "normal";
}
}
component ButtonSurface : Rectangle {
property var containerMargins: {
let item = this;
while (item.parent) {
item = item.parent;
if (item.isAppletContainer) {
return item.getMargins;
}
}
return undefined;
}
anchors {
fill: parent
property bool returnAllMargins: true
// The above makes sure margin is returned even for side margins
// that would be otherwise turned off.
topMargin: !vertical && containerMargins ? -containerMargins('top', returnAllMargins) : 0
leftMargin: vertical && containerMargins ? -containerMargins('left', returnAllMargins) : 0
rightMargin: vertical && containerMargins ? -containerMargins('right', returnAllMargins) : 0
bottomMargin: !vertical && containerMargins ? -containerMargins('bottom', returnAllMargins) : 0
}
Behavior on opacity { OpacityAnimator { duration: Kirigami.Units.longDuration; easing.type: Easing.OutCubic } }
}
KSvg.FrameSvgItem {
anchors {
fill: parent;
}
imagePath: Qt.resolvedUrl("svgs/showdesktop.svg")
prefix: mouseArea.state
}
/*ButtonSurface {
id: hoverSurface
color: Plasmoid.configuration.hoveredColor
opacity: mouseArea.state === "hover" ? 1 : 0
}
ButtonSurface {
id: pressedSurface
color: Plasmoid.configuration.pressedColor
opacity: mouseArea.state === "pressed" ? 1 : 0
}
ButtonSurface {
id: edgeLine
border.color: Plasmoid.configuration.edgeColor
color: "transparent"
border.width: 1
KSvg.FrameSvgItem {
anchors {
fill: parent;
}
imagePath: Qt.resolvedUrl("svgs/showdesktop.svg")
prefix: {
return "normal"
}
}
}*/
/*PlasmaCore.ToolTipArea {
id: toolTip
anchors.fill: parent
mainText: Plasmoid.title
subText: toolTipSubText
textFormat: Text.PlainText
}*/
}
// org.kde.plasma.mediacontrollercompact
Plasma5Support.DataSource {
id: executeSource
engine: "executable"
connectedSources: []
onNewData: (sourceName, data) => {
disconnectSource(sourceName)
} // cmd finished
function getUniqueId(cmd) {
// Note: we assume that 'cmd' is executed quickly so that a previous call
// with the same 'cmd' has already finished (otherwise no new cmd will be
// added because it is already in the list)
// Workaround: We append spaces onto the user's command to workaround this.
var cmd2 = cmd
for (var i = 0; i < 10; i++) {
if (executeSource.connectedSources.includes(cmd2)) {
cmd2 += ' '
}
}
return cmd2
}
}
function exec(cmd) {
executeSource.connectSource(executeSource.getUniqueId(cmd))
}
function performMouseWheelUp() {
root.exec(Plasmoid.configuration.mousewheel_up)
}
function performMouseWheelDown() {
root.exec(Plasmoid.configuration.mousewheel_down)
}
Plasmoid.contextualActions: [
PlasmaCore.Action {
text: i18n("Toggle Lock Widgets")
icon.name: "object-locked"
onTriggered: {
var cmd = 'qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(!locked)"'
root.exec(cmd)
}
},
PlasmaCore.Action {
text: minimizeAllController.titleInactive
checkable: true
checked: minimizeAllController.active
toolTip: minimizeAllController.description
enabled: !peekController.active
onTriggered: minimizeAllController.toggle()
},
PlasmaCore.Action {
text: peekController.titleInactive
checkable: true
checked: peekController.active
toolTip: peekController.description
enabled: !minimizeAllController.active
onTriggered: peekController.toggle()
}
]
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 130 KiB