aerothemeplasma/plasma/plasmoids/io.gitgud.wackyideas.SevenStart/contents/ui/StartOrb.qml

76 lines
2.5 KiB
QML
Raw Permalink Normal View History

2024-08-09 01:20:25 +00:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts 1.1
2024-08-09 01:20:25 +00:00
import QtQuick.Dialogs
import QtQuick.Window 2.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
2024-08-09 01:20:25 +00:00
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.private.kicker 0.1 as Kicker
2024-08-09 01:20:25 +00:00
import org.kde.coreaddons as KCoreAddons // kuser
import org.kde.plasma.private.shell 2.0
import org.kde.kwindowsystem 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.quicklaunch 1.0
import org.kde.kirigami 2.13 as Kirigami
import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
import org.kde.kwindowsystem 1.0
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
/*
* This is the Dialog that displays the Start menu orb when it sticks out
* of the panel. In principle, it works in almost the same way as the
* Start menu user icon, in fact most of the code is directly copied from
* there.
*
* Compared to the popup avatar, this dialog window should NOT have any
* visualParent set, as it causes inexplicable behavior where the orb
2023-09-27 17:50:10 +00:00
* moves away during certain interactions. I have no idea why it does that.
*
* This has been developed only for the bottom/south oriented panel, and
* other orientations should receive support when I begin giving pretty
* much *everything* else support for other orientations.
*
*/
PlasmaCore.Dialog {
id: iconUser
2024-08-09 01:20:25 +00:00
flags: Qt.WindowStaysOnTopHint | Qt.Popup | Qt.WindowTransparentForInput
location: "Floating"
2024-08-09 01:20:25 +00:00
//outputOnly: true // Simplifies things, prevents accidental misclicks when clicking close to the orb.
2023-09-27 17:50:10 +00:00
// Positions are defined later when the plasmoid has been fully loaded, to prevent undefined behavior.
x: 0
y: 0
2023-09-27 17:50:10 +00:00
// Input masks won't be applied correctly when compositing is disabled unless I do this. WHY?
onYChanged: {
2024-08-09 01:20:25 +00:00
Plasmoid.setTransparentWindow();
2023-09-27 17:50:10 +00:00
}
onXChanged: {
2024-08-09 01:20:25 +00:00
Plasmoid.setTransparentWindow();
2023-09-27 17:50:10 +00:00
}
onVisibleChanged: {
if(visible) {
orbTimer.start(); // Delayed initialization, again, for what reason?
}
}
2023-09-27 17:50:10 +00:00
backgroundHints: PlasmaCore.Types.NoBackground // Prevents a dialog SVG background from being drawn.
visible: root.visible && stickOutOrb
2023-09-27 17:50:10 +00:00
opacity: iconUser.visible // To prevent even more NP-hard unpredictable behavior and visual glitches.
// The actual orb button, this dialog window is just a container for it.
mainItem: FloatingOrb {
id: floatingOrbIcon
}
}