mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-05 06:59:50 -05:00
Initial commit
This commit is contained in:
commit
05cd51b54e
148 changed files with 10112 additions and 0 deletions
9
bar/systray/SubTrayMenu.qml
Normal file
9
bar/systray/SubTrayMenu.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
visible: false
|
||||
implicitWidth: 20
|
||||
implicitHeight: 20
|
||||
}
|
||||
97
bar/systray/SysTray.qml
Normal file
97
bar/systray/SysTray.qml
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.SystemTray
|
||||
import "../.."
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
spacing: 10
|
||||
visible: SystemTray.items.values.length > 0
|
||||
implicitHeight: parent.height
|
||||
|
||||
required property var popup
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items
|
||||
|
||||
delegate: Item {
|
||||
id: trayField
|
||||
implicitHeight: parent.height
|
||||
implicitWidth: trayContainer.width
|
||||
required property SystemTrayItem modelData
|
||||
|
||||
MouseArea {
|
||||
id: trayButton
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
// trayText.width = sysTrayContent.width - trayIcon.width - trayContainer.spacing;
|
||||
// trayText.visible = true;
|
||||
root.popup.set(this, trayMenu);
|
||||
}
|
||||
}
|
||||
|
||||
QsMenuOpener {
|
||||
id: menuOpener
|
||||
menu: trayField.modelData.menu
|
||||
}
|
||||
|
||||
WrapperItem {
|
||||
id: trayMenu
|
||||
visible: false
|
||||
|
||||
ColumnLayout {
|
||||
id: menuContainer
|
||||
spacing: 2
|
||||
|
||||
Repeater {
|
||||
model: menuOpener.children
|
||||
|
||||
delegate: TrayMenu {
|
||||
id: sysTrayContent
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: trayContainer
|
||||
color: trayButton.containsMouse ? ShellSettings.settings.colors["primary"] : "transparent"
|
||||
radius: width / 2
|
||||
implicitHeight: parent.height - 2
|
||||
implicitWidth: parent.height - 2
|
||||
anchors.centerIn: parent
|
||||
|
||||
IconImage {
|
||||
id: trayIcon
|
||||
|
||||
source: {
|
||||
switch (trayField.modelData.id) {
|
||||
case "obs":
|
||||
return "image://icon/obs-tray";
|
||||
default:
|
||||
return trayField.modelData.icon;
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 1
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
bar/systray/TrayMenu.qml
Normal file
24
bar/systray/TrayMenu.qml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../.."
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
required property QsMenuEntry modelData
|
||||
|
||||
Rectangle {
|
||||
visible: (root.modelData?.isSeparator ?? false)
|
||||
color: ShellSettings.settings.colors["surface_container_high"]
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 2
|
||||
Layout.leftMargin: 8
|
||||
Layout.rightMargin: 8
|
||||
}
|
||||
|
||||
TrayMenuEntry {
|
||||
visible: !root.modelData?.isSeparator
|
||||
menuData: root.modelData
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
135
bar/systray/TrayMenuEntry.qml
Normal file
135
bar/systray/TrayMenuEntry.qml
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../.."
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
required property var menuData
|
||||
|
||||
WrapperRectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 25
|
||||
radius: 6
|
||||
color: {
|
||||
if (!root.menuData?.enabled)
|
||||
return "transparent";
|
||||
|
||||
if (entryArea.containsMouse)
|
||||
return ShellSettings.settings.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;
|
||||
|
||||
root.menuData?.triggered();
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: menuEntry
|
||||
spacing: 5
|
||||
Layout.fillWidth: true
|
||||
|
||||
Item {
|
||||
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.settings.colors["inverse_surface"]);
|
||||
|
||||
if (!root.menuData?.enabled)
|
||||
return color.darker(2);
|
||||
|
||||
if (entryArea.containsMouse)
|
||||
return Qt.color(ShellSettings.settings.colors["inverse_primary"]);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredHeight: 20
|
||||
Layout.preferredWidth: 20
|
||||
Layout.rightMargin: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrapperRectangle {
|
||||
id: subTrayMenu
|
||||
color: ShellSettings.settings.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: "TrayMenu.qml"
|
||||
Layout.fillWidth: true
|
||||
required property var modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue