| 1 | import QtQuick |
| 2 | import QtQuick.Layouts |
| 3 | import Quickshell |
| 4 | import Quickshell.Wayland |
| 5 | import Quickshell.Hyprland |
| 6 | |
| 7 | PanelWindow { |
| 8 | id: win |
| 9 | property bool opened: false |
| 10 | property int tab: 0 |
| 11 | signal tabRequested(int index) |
| 12 | signal closeRequested() |
| 13 | |
| 14 | visible: opened |
| 15 | anchors { top: true; right: true } |
| 16 | margins { top: 6; right: 8 } // sits just under the bar (bar's exclusive zone is respected) |
| 17 | implicitWidth: 440 |
| 18 | implicitHeight: 610 |
| 19 | exclusiveZone: 0 |
| 20 | color: "transparent" |
| 21 | WlrLayershell.layer: WlrLayer.Overlay |
| 22 | WlrLayershell.namespace: "aurora-panel" |
| 23 | WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand |
| 24 | |
| 25 | // click anywhere outside to close |
| 26 | HyprlandFocusGrab { |
| 27 | windows: [win] |
| 28 | active: win.opened |
| 29 | onCleared: win.closeRequested() |
| 30 | } |
| 31 | |
| 32 | readonly property var tabs: [ |
| 33 | { icon: Theme.iHome, name: "home" }, |
| 34 | { icon: Theme.iVolHigh, name: "audio" }, |
| 35 | { icon: Theme.iWifi, name: "net" }, |
| 36 | { icon: Theme.iBt, name: "bt" }, |
| 37 | { icon: Theme.iChip, name: "system" }, |
| 38 | { icon: Theme.iBell, name: "notifs" } |
| 39 | ] |
| 40 | |
| 41 | Rectangle { |
| 42 | anchors.fill: parent |
| 43 | color: Theme.bgA |
| 44 | border.width: 2 |
| 45 | border.color: Theme.accent |
| 46 | focus: true |
| 47 | Keys.onEscapePressed: win.closeRequested() |
| 48 | |
| 49 | ColumnLayout { |
| 50 | anchors.fill: parent |
| 51 | anchors.margins: 12 |
| 52 | spacing: 10 |
| 53 | |
| 54 | RowLayout { |
| 55 | Layout.fillWidth: true |
| 56 | spacing: 2 |
| 57 | |
| 58 | Repeater { |
| 59 | model: win.tabs |
| 60 | delegate: Rectangle { |
| 61 | id: tabBtn |
| 62 | required property var modelData |
| 63 | required property int index |
| 64 | readonly property bool current: win.tab === index |
| 65 | implicitWidth: lbl.implicitWidth + 22 |
| 66 | implicitHeight: 28 |
| 67 | color: current ? Theme.accent : (tm.containsMouse ? Theme.surfaceHi : "transparent") |
| 68 | |
| 69 | Text { |
| 70 | id: lbl |
| 71 | anchors.centerIn: parent |
| 72 | text: tabBtn.current ? tabBtn.modelData.icon + " " + tabBtn.modelData.name : tabBtn.modelData.icon |
| 73 | color: tabBtn.current ? Theme.bg : Theme.fg |
| 74 | font.family: Theme.font |
| 75 | font.pixelSize: Theme.fontSize |
| 76 | font.bold: true |
| 77 | } |
| 78 | Rectangle { // unread badge on the notifs tab |
| 79 | visible: tabBtn.modelData.name === "notifs" && Notifs.count > 0 && !tabBtn.current |
| 80 | width: 6; height: 6 |
| 81 | anchors.top: parent.top |
| 82 | anchors.right: parent.right |
| 83 | anchors.margins: 3 |
| 84 | color: Theme.accent |
| 85 | } |
| 86 | MouseArea { |
| 87 | id: tm |
| 88 | anchors.fill: parent |
| 89 | hoverEnabled: true |
| 90 | cursorShape: Qt.PointingHandCursor |
| 91 | onClicked: win.tabRequested(tabBtn.index) |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | Item { Layout.fillWidth: true } |
| 96 | IconBtn { icon: Theme.iClose; implicitHeight: 28; onClicked: win.closeRequested() } |
| 97 | } |
| 98 | |
| 99 | Rectangle { Layout.fillWidth: true; Layout.preferredHeight: 1; color: Theme.line } |
| 100 | |
| 101 | StackLayout { |
| 102 | Layout.fillWidth: true |
| 103 | Layout.fillHeight: true |
| 104 | currentIndex: win.tab |
| 105 | |
| 106 | HomePage { onCloseRequested: win.closeRequested() } |
| 107 | AudioPage {} |
| 108 | NetPage { active: win.opened && win.tab === 2 } |
| 109 | BtPage { active: win.opened && win.tab === 3 } |
| 110 | SysPage {} |
| 111 | NotifPage {} |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | } |