Compare commits

..

6 Commits

6 changed files with 182 additions and 14 deletions

20
Bar.qml
View File

@@ -1,9 +1,12 @@
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Effects import QtQuick.Effects
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Hyprland import Quickshell.Hyprland
import Quickshell.Wayland
import "./Bar" import "./Bar"
import "./Services/"
import "Color.js" as Colors import "Color.js" as Colors
Scope { Scope {
@@ -25,6 +28,8 @@ Scope {
required property var modelData required property var modelData
property HyprlandMonitor monitor: Hyprland.monitorFor(modelData) property HyprlandMonitor monitor: Hyprland.monitorFor(modelData)
WlrLayershell.keyboardFocus: monitor.focused == true ? IpcManager.focusState :
WlrKeyboardFocus.None
color: "transparent" color: "transparent"
exclusionMode: ExclusionMode.Normal exclusionMode: ExclusionMode.Normal
exclusiveZone: barExclusionZone exclusiveZone: barExclusionZone
@@ -32,6 +37,21 @@ Scope {
mask: maskRegion mask: maskRegion
screen: modelData screen: modelData
Rectangle {
id: blurOverlay
color: Colors.base
implicitHeight: win.modelData.height
implicitWidth: win.modelData.width
opacity: IpcManager.logoutMenuOpen == true ? 0.8 : 0
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
}
Region { Region {
id: maskRegion id: maskRegion

View File

@@ -15,6 +15,10 @@ Container {
id: root id: root
property Notification latestNotif property Notification latestNotif
property bool logout: false
property double logoutHeight: 100
property double logoutMargin: 7
property double logoutSpacing: 5
required property HyprlandMonitor monitor required property HyprlandMonitor monitor
property bool mpris: false property bool mpris: false
property double mprisHeight: 60 property double mprisHeight: 60
@@ -64,6 +68,24 @@ Container {
mprisTimer.restart(); mprisTimer.restart();
} }
} }
},
State {
name: "logout"
when: root.logout == true
PropertyChanges {
root.boxHeight: root.logoutHeight
root.boxRadius: 13
root.boxWidth: ((root.logoutHeight - (root.logoutMargin * 2)) * 5) + (root.logoutMargin * 2) + (
root.logoutSpacing * 4)
root.visibleTopMargin: 10
}
StateChangeScript {
script: {
root.stack.replace(logoutMenu);
}
}
} }
] ]
@@ -77,6 +99,20 @@ Container {
} }
} }
Connections {
function onCloseLogoutMenu() {
root.overriden = false;
root.logout = false;
}
function onLogoutMenu() {
root.overriden = true;
root.logout = true;
}
target: IpcManager
}
Connections { Connections {
function onNewNotification() { function onNewNotification() {
notification => { notification => {
@@ -127,6 +163,98 @@ Container {
} }
} }
Component {
id: logoutMenu
Item {
id: logoutMenuRoot
property var logoutModel: [
{
color: Colors.red,
text: "s",
key: Qt.Key_S
},
{
color: Colors.peach,
text: "e",
key: Qt.Key_E
},
{
color: Colors.yellow,
text: "r",
key: Qt.Key_R
},
{
color: Colors.green,
text: "l",
key: Qt.Key_L
},
{
color: Colors.sky,
text: "u",
key: Qt.Key_U
},
]
Component.onCompleted: {
forceActiveFocus();
}
Keys.onPressed: event => {
if (event.key == Qt.Key_Escape) {
IpcManager.closeLogoutMenu();
} else {
for (let button of logoutMenuRoot.logoutModel) {
if (button.key == event.key) {
event.accepted = true;
}
}
}
}
RowLayout {
spacing: root.logoutSpacing
anchors {
fill: parent
margins: root.logoutMargin
}
Repeater {
delegate: logoutButton
model: logoutMenuRoot.logoutModel
}
Component {
id: logoutButton
Item {
id: logoutButtonRoot
// Key yen isn't on my keyboard, acts as an errorless analog for no bind
required property var modelData
Layout.fillHeight: true
Layout.fillWidth: true
Rectangle {
anchors.fill: parent
color: logoutButtonRoot.modelData.color
radius: 7
StyledText {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
text: logoutButtonRoot.modelData.text
verticalAlignment: Qt.AlignVCenter
}
}
}
}
}
}
}
Component { Component {
id: time id: time
@@ -134,7 +262,7 @@ Container {
property string component: "time" property string component: "time"
horizontalAlignment: Qt.AlignCenter horizontalAlignment: Qt.AlignCenter
text: Time.time text: TimeManager.time
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
} }
} }

View File

@@ -25,18 +25,6 @@ Container {
defaultItem: placeholder defaultItem: placeholder
exclusiveMonitor: monitor exclusiveMonitor: monitor
states: [
State {
name: "hovered"
when: root.hovered
PropertyChanges {
root.barHeight: 30
root.workspaceWidth: 20
}
}
]
Component { Component {
id: placeholder id: placeholder

31
Services/IpcManager.qml Normal file
View File

@@ -0,0 +1,31 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
import Quickshell.Wayland
Singleton {
id: root
property var focusState: WlrKeyboardFocus.None
property bool logoutMenuOpen: false
signal closeLogoutMenu
signal logoutMenu
onCloseLogoutMenu: {
root.focusState = WlrKeyboardFocus.None;
root.logoutMenuOpen = false;
}
IpcHandler {
function openLogoutMenu(): void {
root.logoutMenu();
root.focusState = WlrKeyboardFocus.Exclusive;
root.logoutMenuOpen = true;
}
target: "root"
}
}

View File

@@ -1,8 +1,9 @@
module Services module Services
singleton Time 1.0 Time.qml singleton TimeManager 1.0 TimeManager.qml
singleton NotificationManager 1.0 NotificationManager.qml singleton NotificationManager 1.0 NotificationManager.qml
singleton WorkspaceManager 1.0 WorkspaceManager.qml singleton WorkspaceManager 1.0 WorkspaceManager.qml
singleton BluetoothManager 1.0 BluetoothManager.qml singleton BluetoothManager 1.0 BluetoothManager.qml
singleton MprisManager 1.0 MprisManager.qml singleton MprisManager 1.0 MprisManager.qml
singleton BatteryManager 1.0 BatteryManager.qml singleton BatteryManager 1.0 BatteryManager.qml
singleton NetworkManager 1.0 NetworkManager.qml singleton NetworkManager 1.0 NetworkManager.qml
singleton IpcManager 1.0 IpcManager.qml