logout menu fully functional
This commit is contained in:
30
Bar/Time.qml
30
Bar/Time.qml
@@ -4,6 +4,7 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Io
|
||||||
import Quickshell.Services.Notifications
|
import Quickshell.Services.Notifications
|
||||||
import Quickshell.Widgets
|
import Quickshell.Widgets
|
||||||
|
|
||||||
@@ -172,28 +173,33 @@ Container {
|
|||||||
property var logoutModel: [
|
property var logoutModel: [
|
||||||
{
|
{
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
text: "s",
|
text: "",
|
||||||
key: Qt.Key_S
|
key: Qt.Key_S,
|
||||||
|
command: ["systemctl", "poweroff"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color: Colors.peach,
|
color: Colors.peach,
|
||||||
text: "e",
|
text: "",
|
||||||
key: Qt.Key_E
|
key: Qt.Key_E,
|
||||||
|
command: ["hyprctl", "dispatch", "'hl.dsp.exit()'"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color: Colors.yellow,
|
color: Colors.yellow,
|
||||||
text: "r",
|
text: "",
|
||||||
key: Qt.Key_R
|
key: Qt.Key_R,
|
||||||
|
command: ["systemctl", "reboot"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color: Colors.green,
|
color: Colors.green,
|
||||||
text: "l",
|
text: "",
|
||||||
key: Qt.Key_L
|
key: Qt.Key_L,
|
||||||
|
command: ["hyprlock"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
color: Colors.sky,
|
color: Colors.sky,
|
||||||
text: "u",
|
text: "",
|
||||||
key: Qt.Key_U
|
key: Qt.Key_U,
|
||||||
|
command: ["systemctl", "suspend"]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -206,7 +212,9 @@ Container {
|
|||||||
} else {
|
} else {
|
||||||
for (let button of logoutMenuRoot.logoutModel) {
|
for (let button of logoutMenuRoot.logoutModel) {
|
||||||
if (button.key == event.key) {
|
if (button.key == event.key) {
|
||||||
|
IpcManager.closeLogoutMenu();
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
|
Quickshell.execDetached(button.command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,7 +252,9 @@ Container {
|
|||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
fontSize: 25
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
|
propo: true
|
||||||
text: logoutButtonRoot.modelData.text
|
text: logoutButtonRoot.modelData.text
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user