mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-04 22:49:50 -05:00
bar/systray: add arrow for entries with children
This commit is contained in:
parent
ff99ac76cc
commit
3f8ed91cd3
4 changed files with 44 additions and 71 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import "battery"
|
||||||
import "control" as Control
|
import "control" as Control
|
||||||
import "systray" as SysTray
|
import "systray" as SysTray
|
||||||
import "notifications" as Notifications
|
import "notifications" as Notifications
|
||||||
|
|
@ -55,7 +56,7 @@ PanelWindow {
|
||||||
|
|
||||||
// Right
|
// Right
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 15
|
spacing: 10
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
|
@ -76,6 +77,7 @@ PanelWindow {
|
||||||
|
|
||||||
BatteryIndicator {
|
BatteryIndicator {
|
||||||
id: batteryIndicator
|
id: batteryIndicator
|
||||||
|
popup: root.popup
|
||||||
}
|
}
|
||||||
|
|
||||||
// Control.Button {
|
// Control.Button {
|
||||||
|
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import QtQuick
|
|
||||||
import Qt5Compat.GraphicalEffects
|
|
||||||
import Quickshell.Widgets
|
|
||||||
import Quickshell.Services.UPower
|
|
||||||
import ".."
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
implicitWidth: 22
|
|
||||||
implicitHeight: 22
|
|
||||||
visible: UPower.displayDevice.isLaptopBattery
|
|
||||||
|
|
||||||
layer.enabled: true
|
|
||||||
layer.effect: OpacityMask {
|
|
||||||
source: Rectangle {
|
|
||||||
width: root.width
|
|
||||||
height: root.height
|
|
||||||
color: "white"
|
|
||||||
}
|
|
||||||
|
|
||||||
maskSource: IconImage {
|
|
||||||
implicitSize: root.width
|
|
||||||
source: "root:resources/battery/battery.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: batteryBackground
|
|
||||||
color: Qt.color(ShellSettings.settings.colors["surface"]).lighter(4)
|
|
||||||
opacity: 0.75
|
|
||||||
anchors {
|
|
||||||
fill: parent
|
|
||||||
margins: 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: batteryPercentage
|
|
||||||
width: (parent.width - 4) * UPower.displayDevice.percentage
|
|
||||||
color: ShellSettings.settings.colors["inverse_surface"]
|
|
||||||
anchors {
|
|
||||||
left: batteryBackground.left
|
|
||||||
top: batteryBackground.top
|
|
||||||
bottom: batteryBackground.bottom
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Effects
|
import QtQuick.Effects
|
||||||
|
|
@ -62,6 +63,7 @@ PopupWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
|
grab.active = true;
|
||||||
isOpen = true;
|
isOpen = true;
|
||||||
root.visible = true; // set and leave open
|
root.visible = true; // set and leave open
|
||||||
root.content.visible = true;
|
root.content.visible = true;
|
||||||
|
|
@ -70,6 +72,7 @@ PopupWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
|
grab.active = false;
|
||||||
isOpen = false;
|
isOpen = false;
|
||||||
popupContainer.opacity = 0;
|
popupContainer.opacity = 0;
|
||||||
popupContent.opacity = 0;
|
popupContent.opacity = 0;
|
||||||
|
|
@ -137,13 +140,22 @@ PopupWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HoverHandler {
|
// broken for elements in the popup that have hover/mousearea's
|
||||||
id: hover
|
// HoverHandler {
|
||||||
enabled: true
|
// id: hover
|
||||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
// enabled: true
|
||||||
onHoveredChanged: {
|
// acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||||
if (hovered == false)
|
// onHoveredChanged: {
|
||||||
root.hide();
|
// if (hovered == false)
|
||||||
|
// root.hide();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
HyprlandFocusGrab {
|
||||||
|
id: grab
|
||||||
|
windows: [root, root.bar]
|
||||||
|
onCleared: {
|
||||||
|
root.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,12 @@ import Quickshell.Widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import "../../widgets" as Widgets
|
||||||
import "../.."
|
import "../.."
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
required property var menuData
|
required property QsMenuEntry menuData
|
||||||
signal interacted
|
signal interacted
|
||||||
|
|
||||||
WrapperRectangle {
|
WrapperRectangle {
|
||||||
|
|
@ -92,24 +93,32 @@ ColumnLayout {
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root.menuData
|
|
||||||
|
|
||||||
function onTextChanged() {
|
|
||||||
console.log("Hi");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.preferredHeight: 20
|
Layout.preferredHeight: 20
|
||||||
Layout.preferredWidth: 20
|
Layout.preferredWidth: 20
|
||||||
Layout.rightMargin: 5
|
Layout.rightMargin: 5
|
||||||
|
|
||||||
|
Widgets.IconButton {
|
||||||
|
id: arrowButton
|
||||||
|
visible: root.menuData?.hasChildren
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue