Compare commits
2 commits
fe8261f7af
...
618fc22e80
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
618fc22e80 | ||
|
|
3c3fe368bc |
7 changed files with 94 additions and 57 deletions
|
|
@ -1,11 +1,29 @@
|
||||||
import qs.config
|
import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Widgets
|
||||||
|
|
||||||
Drawer {
|
Drawer {
|
||||||
id: control
|
id: control
|
||||||
dim: false
|
dim: false
|
||||||
background: Rectangle {
|
property bool focused: false
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
focused = visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
HyprlandFocusGrab {
|
||||||
|
active: control.focused
|
||||||
|
windows: [QsWindow.window]
|
||||||
|
onCleared: {
|
||||||
|
control.focused = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
background: ClippingWrapperRectangle {
|
||||||
|
margin: 4
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (control.edge == Qt.TopEdge) {
|
if (control.edge == Qt.TopEdge) {
|
||||||
radius = 8;
|
radius = 8;
|
||||||
|
|
@ -20,6 +38,24 @@ Drawer {
|
||||||
topRightRadius = 8;
|
topRightRadius = 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color: Styling.theme.base100
|
color: Styling.theme.base300
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (control.edge == Qt.TopEdge) {
|
||||||
|
radius = 8;
|
||||||
|
} else if (control.edge == Qt.LeftEdge) {
|
||||||
|
topRightRadius = 8;
|
||||||
|
bottomRightRadius = 8;
|
||||||
|
} else if (control.edge == Qt.RightEdge) {
|
||||||
|
topLeftRadius = 8;
|
||||||
|
bottomLeftRadius = 8;
|
||||||
|
} else if (control.edge == Qt.BottomEdge) {
|
||||||
|
topLeftRadius = 8;
|
||||||
|
topRightRadius = 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
color: Styling.theme.base100
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ RowLayout {
|
||||||
spacing: 4
|
spacing: 4
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: SystemTray.items
|
model: SystemTray.items.values
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: loader
|
id: loader
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,11 @@ import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Services.SystemTray
|
import Quickshell.Services.SystemTray
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
import "menu/"
|
|
||||||
|
|
||||||
StyledIconButton {
|
StyledIconButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property SystemTrayItem trayItem
|
required property SystemTrayItem trayItem
|
||||||
|
|
||||||
onClicked: menu.toggle()
|
onClicked: menu.toggle()
|
||||||
|
|
||||||
|
|
@ -28,7 +27,7 @@ StyledIconButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
TrayMenu {
|
||||||
id: menu
|
id: menu
|
||||||
|
|
||||||
anchor.item: root
|
anchor.item: root
|
||||||
|
|
|
||||||
49
modules/bar/components/tray/TrayMenu.qml
Normal file
49
modules/bar/components/tray/TrayMenu.qml
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
|
import qs.components
|
||||||
|
import qs.config
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
|
||||||
|
StyledPopupWindow {
|
||||||
|
id: window
|
||||||
|
|
||||||
|
required property QsMenuOpener menuOpener
|
||||||
|
|
||||||
|
content: ColumnLayout {
|
||||||
|
spacing: 4
|
||||||
|
Repeater {
|
||||||
|
model: window.menuOpener.children.values
|
||||||
|
delegate: Loader {
|
||||||
|
id: loader
|
||||||
|
required property QsMenuEntry modelData
|
||||||
|
|
||||||
|
active: true
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
console.log(modelData.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.minimumWidth: 160
|
||||||
|
|
||||||
|
sourceComponent: modelData.isSeparator ? menuSeperator : menuItem
|
||||||
|
property Component menuSeperator: WrapperItem {
|
||||||
|
margin: 4
|
||||||
|
Rectangle {
|
||||||
|
implicitHeight: 2
|
||||||
|
|
||||||
|
color: Styling.theme.base200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
property Component menuItem: StyledButton {
|
||||||
|
text: loader.modelData.text
|
||||||
|
|
||||||
|
onClicked: loader.modelData.triggered()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
pragma ComponentBehavior: Bound
|
|
||||||
|
|
||||||
import qs.components
|
|
||||||
import qs.config
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
StyledPopupWindow {
|
|
||||||
id: window
|
|
||||||
|
|
||||||
property QsMenuOpener menuOpener
|
|
||||||
|
|
||||||
content: ColumnLayout {
|
|
||||||
spacing: 8
|
|
||||||
Repeater {
|
|
||||||
model: window.menuOpener.children
|
|
||||||
delegate: Loader {
|
|
||||||
id: loader
|
|
||||||
required property QsMenuEntry modelData
|
|
||||||
|
|
||||||
active: true
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.minimumWidth: 160
|
|
||||||
|
|
||||||
sourceComponent: modelData.isSeparator ? menuSeperator : menuItem
|
|
||||||
property Component menuSeperator: Rectangle {
|
|
||||||
implicitHeight: 2
|
|
||||||
|
|
||||||
color: Styling.theme.base100
|
|
||||||
}
|
|
||||||
property Component menuItem: MenuItem {
|
|
||||||
menuEntry: loader.modelData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import qs.components
|
|
||||||
import Quickshell
|
|
||||||
|
|
||||||
StyledButton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property QsMenuEntry menuEntry
|
|
||||||
|
|
||||||
text: root.menuEntry.text
|
|
||||||
|
|
||||||
onClicked: menuEntry.triggered()
|
|
||||||
}
|
|
||||||
|
|
@ -12,6 +12,10 @@ StyledDrawer {
|
||||||
|
|
||||||
visible: Visibility.dashboard
|
visible: Visibility.dashboard
|
||||||
|
|
||||||
|
onFocusedChanged: {
|
||||||
|
Visibility.dashboard = focused;
|
||||||
|
}
|
||||||
|
|
||||||
WrapperItem {
|
WrapperItem {
|
||||||
margin: 32
|
margin: 32
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue