Compare commits

..

4 Commits

6 changed files with 108 additions and 55 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

@@ -100,6 +100,11 @@ Container {
} }
Connections { Connections {
function onCloseLogoutMenu() {
root.overriden = false;
root.logout = false;
}
function onLogoutMenu() { function onLogoutMenu() {
root.overriden = true; root.overriden = true;
root.logout = true; root.logout = true;
@@ -164,6 +169,49 @@ Container {
Item { Item {
id: logoutMenuRoot 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 { RowLayout {
spacing: root.logoutSpacing spacing: root.logoutSpacing
@@ -172,29 +220,36 @@ Container {
margins: root.logoutMargin margins: root.logoutMargin
} }
LogoutButton { Repeater {
color: Colors.red delegate: logoutButton
logoutText: "a" model: logoutMenuRoot.logoutModel
} }
LogoutButton { Component {
color: Colors.peach id: logoutButton
logoutText: "a"
}
LogoutButton { Item {
color: Colors.yellow id: logoutButtonRoot
logoutText: "a"
}
LogoutButton { // Key yen isn't on my keyboard, acts as an errorless analog for no bind
color: Colors.green required property var modelData
logoutText: "a"
}
LogoutButton { Layout.fillHeight: true
color: Colors.sky Layout.fillWidth: true
logoutText: "a"
Rectangle {
anchors.fill: parent
color: logoutButtonRoot.modelData.color
radius: 7
StyledText {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
text: logoutButtonRoot.modelData.text
verticalAlignment: Qt.AlignVCenter
}
}
}
} }
} }
} }
@@ -207,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
} }
} }
@@ -379,27 +434,4 @@ Container {
} }
} }
} }
component LogoutButton: Item {
id: logoutButtonRoot
property color color: Colors.surface1
property string logoutText: ""
Layout.fillHeight: true
Layout.fillWidth: true
Rectangle {
anchors.fill: parent
color: logoutButtonRoot.color
radius: 7
StyledText {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
text: logoutButtonRoot.logoutText
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

View File

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

View File

@@ -1,5 +1,5 @@
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