PowerMenu wip
This commit is contained in:
parent
94b4a096e7
commit
8663b36ecb
3 changed files with 386 additions and 7 deletions
|
|
@ -20,8 +20,7 @@ NLoader {
|
||||||
|
|
||||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||||
|
|
||||||
property var tabsModel: [
|
property var tabsModel: [{
|
||||||
{
|
|
||||||
"label": "General",
|
"label": "General",
|
||||||
"icon": "tune",
|
"icon": "tune",
|
||||||
"source": "Tabs/General.qml"
|
"source": "Tabs/General.qml"
|
||||||
|
|
@ -57,8 +56,7 @@ NLoader {
|
||||||
"label": "Wallpaper Selector",
|
"label": "Wallpaper Selector",
|
||||||
"icon": "wallpaper_slideshow",
|
"icon": "wallpaper_slideshow",
|
||||||
"source": "Tabs/WallpaperSelector.qml"
|
"source": "Tabs/WallpaperSelector.qml"
|
||||||
},
|
}, // {
|
||||||
// {
|
|
||||||
// "label": "Misc",
|
// "label": "Misc",
|
||||||
// "icon": "more_horiz",
|
// "icon": "more_horiz",
|
||||||
// "source": "Tabs/Misc.qml"
|
// "source": "Tabs/Misc.qml"
|
||||||
|
|
@ -112,7 +110,7 @@ NLoader {
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: tabItem
|
id: tabItem
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 32 * scaling // Back to original height
|
height: 32 * scaling // Back to original height
|
||||||
radius: Style.radiusSmall * scaling
|
radius: Style.radiusSmall * scaling
|
||||||
|
|
@ -120,7 +118,7 @@ NLoader {
|
||||||
border.color: "transparent"
|
border.color: "transparent"
|
||||||
border.width: 0
|
border.width: 0
|
||||||
|
|
||||||
readonly property bool selected: index === currentTabIndex
|
readonly property bool selected: index === currentTabIndex
|
||||||
|
|
||||||
// Subtle hover effect: only icon/text color tint on hover
|
// Subtle hover effect: only icon/text color tint on hover
|
||||||
property bool hovering: false
|
property bool hovering: false
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,18 @@ NBox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NIconButton {
|
NIconButton {
|
||||||
|
id: powerButton
|
||||||
icon: "power_settings_new"
|
icon: "power_settings_new"
|
||||||
|
onClicked: {
|
||||||
|
//settingsPanel.isLoaded = !settingsPanel.isLoaded
|
||||||
|
powerMenu.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------
|
||||||
|
// Uptime
|
||||||
Timer {
|
Timer {
|
||||||
interval: 60000
|
interval: 60000
|
||||||
repeat: true
|
repeat: true
|
||||||
|
|
@ -99,4 +106,378 @@ NBox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------
|
||||||
|
// Logout menu
|
||||||
|
function logout() {
|
||||||
|
if (WorkspaceManager.isNiri) {
|
||||||
|
logoutProcessNiri.running = true
|
||||||
|
} else if (WorkspaceManager.isHyprland) {
|
||||||
|
logoutProcessHyprland.running = true
|
||||||
|
} else {
|
||||||
|
console.warn("No supported compositor detected for logout")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function suspend() {
|
||||||
|
suspendProcess.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function shutdown() {
|
||||||
|
shutdownProcess.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function reboot() {
|
||||||
|
rebootProcess.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSystemInfo() {
|
||||||
|
uptimeProcess.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: shutdownProcess
|
||||||
|
|
||||||
|
command: ["shutdown", "-h", "now"]
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: rebootProcess
|
||||||
|
|
||||||
|
command: ["reboot"]
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: suspendProcess
|
||||||
|
|
||||||
|
command: ["systemctl", "suspend"]
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: logoutProcessNiri
|
||||||
|
|
||||||
|
command: ["niri", "msg", "action", "quit", "--skip-confirmation"]
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: logoutProcessHyprland
|
||||||
|
|
||||||
|
command: ["hyprctl", "dispatch", "exit"]
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: logoutProcess
|
||||||
|
|
||||||
|
command: ["loginctl", "terminate-user", Quickshell.env("USER")]
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
NPanel {
|
||||||
|
id: powerMenu
|
||||||
|
|
||||||
|
anchors.top: powerButton.bottom
|
||||||
|
anchors.right: powerButton.right
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 160 * scaling
|
||||||
|
height: 220 * scaling
|
||||||
|
color: Colors.surface
|
||||||
|
radius: 8 * scaling
|
||||||
|
border.color: Colors.outline
|
||||||
|
border.width: 1 * scaling
|
||||||
|
visible: true
|
||||||
|
z: 9999
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 32 * scaling
|
||||||
|
anchors.topMargin: powerButton.y + powerButton.height + 48 * scaling
|
||||||
|
|
||||||
|
// Prevent closing when clicking in the panel bg
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 8 * scaling
|
||||||
|
spacing: 4 * scaling
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 36 * scaling
|
||||||
|
radius: 6 * scaling
|
||||||
|
color: lockButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.leftMargin: 12 * scaling
|
||||||
|
anchors.rightMargin: 12 * scaling
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: lockRow
|
||||||
|
spacing: 8 * scaling
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "lock_outline"
|
||||||
|
font.family: "Material Symbols Outlined"
|
||||||
|
font.pixelSize: 16 * scaling
|
||||||
|
color: lockButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Lock Screen"
|
||||||
|
font.pixelSize: 14 * scaling
|
||||||
|
color: lockButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: lockButtonArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
lockScreen.locked = true
|
||||||
|
systemMenu.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 36 * scaling
|
||||||
|
radius: 6 * scaling
|
||||||
|
color: suspendButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.leftMargin: 12 * scaling
|
||||||
|
anchors.rightMargin: 12 * scaling
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: suspendRow
|
||||||
|
spacing: 8 * scaling
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "bedtime"
|
||||||
|
font.family: "Material Symbols Outlined"
|
||||||
|
font.pixelSize: 16 * scaling
|
||||||
|
color: suspendButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Suspend"
|
||||||
|
font.pixelSize: 14 * scaling
|
||||||
|
color: suspendButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: suspendButtonArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
suspend()
|
||||||
|
systemMenu.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 36 * scaling
|
||||||
|
radius: 6 * scaling
|
||||||
|
color: rebootButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.leftMargin: 12 * scaling
|
||||||
|
anchors.rightMargin: 12 * scaling
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: rebootRow
|
||||||
|
spacing: 8 * scaling
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "refresh"
|
||||||
|
font.family: "Material Symbols Outlined"
|
||||||
|
font.pixelSize: 16 * scaling
|
||||||
|
color: rebootButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Reboot"
|
||||||
|
font.pixelSize: 14 * scaling
|
||||||
|
color: rebootButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: rebootButtonArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
reboot()
|
||||||
|
systemMenu.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 36 * scaling
|
||||||
|
radius: 6 * scaling
|
||||||
|
color: logoutButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.leftMargin: 12 * scaling
|
||||||
|
anchors.rightMargin: 12 * scaling
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: logoutRow
|
||||||
|
spacing: 8 * scaling
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "exit_to_app"
|
||||||
|
font.family: "Material Symbols Outlined"
|
||||||
|
font.pixelSize: 16 * scaling
|
||||||
|
color: logoutButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Logout"
|
||||||
|
font.pixelSize: 14 * scaling
|
||||||
|
color: logoutButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: logoutButtonArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
logout()
|
||||||
|
systemMenu.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 36 * scaling
|
||||||
|
radius: 6 * scaling
|
||||||
|
color: shutdownButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.leftMargin: 12 * scaling
|
||||||
|
anchors.rightMargin: 12 * scaling
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: shutdownRow
|
||||||
|
spacing: 8 * scaling
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "power_settings_new"
|
||||||
|
font.family: "Material Symbols Outlined"
|
||||||
|
font.pixelSize: 16 * scaling
|
||||||
|
color: shutdownButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Shutdown"
|
||||||
|
font.pixelSize: 14 * scaling
|
||||||
|
color: shutdownButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: 1 * scaling
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: shutdownButtonArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
shutdown()
|
||||||
|
systemMenu.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ Singleton {
|
||||||
onLoaded: function () {
|
onLoaded: function () {
|
||||||
Qt.callLater(function () {
|
Qt.callLater(function () {
|
||||||
if (adapter.wallpaper.current !== "") {
|
if (adapter.wallpaper.current !== "") {
|
||||||
console.log("Settings: Initializing wallpaper to:", adapter.wallpaper.current)
|
console.log("[Settings] Set current wallpaper")
|
||||||
Wallpapers.setCurrentWallpaper(adapter.wallpaper.current, true)
|
Wallpapers.setCurrentWallpaper(adapter.wallpaper.current, true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue