mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-05 06:59: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.Layouts
|
||||
import Quickshell
|
||||
import "battery"
|
||||
import "control" as Control
|
||||
import "systray" as SysTray
|
||||
import "notifications" as Notifications
|
||||
|
|
@ -55,7 +56,7 @@ PanelWindow {
|
|||
|
||||
// Right
|
||||
RowLayout {
|
||||
spacing: 15
|
||||
spacing: 10
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
|
|
@ -76,6 +77,7 @@ PanelWindow {
|
|||
|
||||
BatteryIndicator {
|
||||
id: batteryIndicator
|
||||
popup: root.popup
|
||||
}
|
||||
|
||||
// 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.Hyprland
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
|
@ -62,6 +63,7 @@ PopupWindow {
|
|||
}
|
||||
|
||||
function show() {
|
||||
grab.active = true;
|
||||
isOpen = true;
|
||||
root.visible = true; // set and leave open
|
||||
root.content.visible = true;
|
||||
|
|
@ -70,6 +72,7 @@ PopupWindow {
|
|||
}
|
||||
|
||||
function hide() {
|
||||
grab.active = false;
|
||||
isOpen = false;
|
||||
popupContainer.opacity = 0;
|
||||
popupContent.opacity = 0;
|
||||
|
|
@ -137,13 +140,22 @@ PopupWindow {
|
|||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hover
|
||||
enabled: true
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
onHoveredChanged: {
|
||||
if (hovered == false)
|
||||
root.hide();
|
||||
// broken for elements in the popup that have hover/mousearea's
|
||||
// HoverHandler {
|
||||
// id: hover
|
||||
// enabled: true
|
||||
// acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
// onHoveredChanged: {
|
||||
// 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.Controls
|
||||
import QtQuick.Layouts
|
||||
import "../../widgets" as Widgets
|
||||
import "../.."
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
required property var menuData
|
||||
required property QsMenuEntry menuData
|
||||
signal interacted
|
||||
|
||||
WrapperRectangle {
|
||||
|
|
@ -92,24 +93,32 @@ ColumnLayout {
|
|||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Connections {
|
||||
target: root.menuData
|
||||
|
||||
function onTextChanged() {
|
||||
console.log("Hi");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredHeight: 20
|
||||
Layout.preferredWidth: 20
|
||||
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