mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-05 06:59:50 -05:00
progress maybe, maybe not
This commit is contained in:
parent
ce6c1f410c
commit
83a0ac8899
21 changed files with 1412 additions and 49 deletions
96
shell/experimental-bar/systray/SysTray.qml
Normal file
96
shell/experimental-bar/systray/SysTray.qml
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.SystemTray
|
||||
import "../../widgets" as Widgets
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
spacing: 5
|
||||
visible: SystemTray.items.values.length > 0
|
||||
|
||||
required property var popup
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items
|
||||
|
||||
delegate: Item {
|
||||
id: trayField
|
||||
Layout.preferredWidth: parent.height
|
||||
Layout.fillHeight: true
|
||||
required property SystemTrayItem modelData
|
||||
|
||||
Widgets.MaterialButton {
|
||||
id: trayButton
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
menuOpener.menu = trayField.modelData.menu;
|
||||
|
||||
if (root.popup.content == trayMenu) {
|
||||
root.popup.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
root.popup.set(this, trayMenu);
|
||||
root.popup.show();
|
||||
}
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 2
|
||||
}
|
||||
|
||||
IconImage {
|
||||
id: trayIcon
|
||||
anchors.fill: parent
|
||||
source: {
|
||||
// console.log(trayField.modelData.id);
|
||||
switch (trayField.modelData.id) {
|
||||
case "obs":
|
||||
return "image://icon/obs-tray";
|
||||
default:
|
||||
return trayField.modelData.icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QsMenuOpener {
|
||||
id: menuOpener
|
||||
}
|
||||
|
||||
WrapperItem {
|
||||
id: trayMenu
|
||||
visible: false
|
||||
|
||||
property var leftItem: false
|
||||
property var rightItem: false
|
||||
|
||||
ColumnLayout {
|
||||
id: menuContainer
|
||||
spacing: 2
|
||||
|
||||
Repeater {
|
||||
model: menuOpener.children
|
||||
|
||||
delegate: TrayMenuItem {
|
||||
id: sysTrayContent
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
rootMenu: trayMenu
|
||||
|
||||
onInteracted: {
|
||||
root.popup.hide();
|
||||
menuOpener.menu = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
170
shell/experimental-bar/systray/TrayMenuEntry.qml
Normal file
170
shell/experimental-bar/systray/TrayMenuEntry.qml
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../../widgets" as Widgets
|
||||
import "../.."
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
required property QsMenuEntry menuData
|
||||
required property var rootMenu
|
||||
signal interacted
|
||||
|
||||
Component.onCompleted: {
|
||||
if (menuData?.buttonType !== QsMenuButtonType.None || menuData?.icon != "") {
|
||||
rootMenu.leftItem = true;
|
||||
}
|
||||
|
||||
if (menuData?.hasChildren) {
|
||||
rootMenu.rightItem = true;
|
||||
}
|
||||
}
|
||||
|
||||
WrapperRectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 25
|
||||
radius: 6
|
||||
color: {
|
||||
if (!root.menuData?.enabled)
|
||||
return "transparent";
|
||||
|
||||
if (entryArea.containsMouse)
|
||||
return ShellSettings.colors["primary"];
|
||||
|
||||
return "transparent";
|
||||
}
|
||||
|
||||
WrapperMouseArea {
|
||||
id: entryArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (!root.menuData?.enabled)
|
||||
return;
|
||||
|
||||
if (root.menuData?.hasChildren) {
|
||||
subTrayMenu.visible = !subTrayMenu.visible;
|
||||
return;
|
||||
}
|
||||
|
||||
root.menuData?.triggered();
|
||||
root.interacted();
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: menuEntry
|
||||
spacing: 5
|
||||
Layout.fillWidth: true
|
||||
|
||||
Item {
|
||||
visible: root.rootMenu.leftItem
|
||||
Layout.preferredWidth: 20
|
||||
Layout.fillHeight: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.leftMargin: 5
|
||||
|
||||
RadioButton {
|
||||
id: radioButton
|
||||
visible: (root.menuData?.buttonType === QsMenuButtonType.RadioButton) ?? false
|
||||
checked: (root.menuData?.checkState) ?? false
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: checkBox
|
||||
visible: (root.menuData?.buttonType === QsMenuButtonType.CheckBox) ?? false
|
||||
checked: (root.menuData?.checkState) ?? false
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
IconImage {
|
||||
id: entryImage
|
||||
visible: (root.menuData?.buttonType === QsMenuButtonType.None && root.menuData?.icon !== "") ?? false
|
||||
source: (root.menuData?.icon) ?? ""
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: text
|
||||
text: root.menuData?.text ?? ""
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: {
|
||||
let color = Qt.color(ShellSettings.colors["inverse_surface"]);
|
||||
|
||||
if (!root.menuData?.enabled)
|
||||
return color.darker(2);
|
||||
|
||||
if (entryArea.containsMouse)
|
||||
return Qt.color(ShellSettings.colors["inverse_primary"]);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Item {
|
||||
visible: root.rootMenu.rightItem
|
||||
Layout.preferredHeight: 20
|
||||
Layout.preferredWidth: 20
|
||||
Layout.rightMargin: 5
|
||||
|
||||
Widgets.IconButton {
|
||||
id: arrowButton
|
||||
visible: root.menuData?.hasChildren ?? false
|
||||
activeRectangle: false
|
||||
source: "root:resources/general/right-arrow.svg"
|
||||
rotation: subTrayMenu.visible ? 90 : 0
|
||||
anchors.fill: parent
|
||||
|
||||
Behavior on rotation {
|
||||
NumberAnimation {
|
||||
duration: 150
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
root.expanded = !root.expanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrapperRectangle {
|
||||
id: subTrayMenu
|
||||
color: ShellSettings.colors["surface_container"]
|
||||
radius: 8
|
||||
visible: false
|
||||
Layout.fillWidth: true
|
||||
|
||||
QsMenuOpener {
|
||||
id: menuOpener
|
||||
menu: root.menuData
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: subTrayContainer
|
||||
spacing: 2
|
||||
Layout.fillWidth: true
|
||||
|
||||
Repeater {
|
||||
model: menuOpener.children
|
||||
|
||||
delegate: BoundComponent {
|
||||
id: subMenuEntry
|
||||
source: "TrayMenuItem.qml"
|
||||
Layout.fillWidth: true
|
||||
required property var modelData
|
||||
property var rootMenu: root.rootMenu
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
shell/experimental-bar/systray/TrayMenuItem.qml
Normal file
29
shell/experimental-bar/systray/TrayMenuItem.qml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../.."
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
required property QsMenuEntry modelData
|
||||
required property var rootMenu
|
||||
property var leftItem
|
||||
signal interacted
|
||||
|
||||
Rectangle {
|
||||
visible: (root.modelData?.isSeparator ?? false)
|
||||
color: ShellSettings.colors["surface_container_high"]
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 2
|
||||
Layout.leftMargin: 8
|
||||
Layout.rightMargin: 8
|
||||
}
|
||||
|
||||
TrayMenuEntry {
|
||||
visible: !root.modelData?.isSeparator
|
||||
rootMenu: root.rootMenu
|
||||
menuData: root.modelData
|
||||
Layout.fillWidth: true
|
||||
onInteracted: root.interacted()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue