mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-06 20:12:29 +00:00
Merge pull request #738 from bokicoder/patch-1
SessionMenu: add hibernate option
This commit is contained in:
@@ -652,7 +652,8 @@
|
||||
"logout": "Abmelden",
|
||||
"reboot": "Neu starten",
|
||||
"shutdown": "Herunterfahren",
|
||||
"suspend": "Ruhezustand",
|
||||
"suspend": "Energiesparmodus",
|
||||
"hibernate": "Ruhezustand",
|
||||
"title": "Sitzungsmenü"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "Reboot",
|
||||
"shutdown": "Shutdown",
|
||||
"suspend": "Suspend",
|
||||
"hibernate": "Hibernate",
|
||||
"title": "Session Menu"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "Reiniciar",
|
||||
"shutdown": "Apagar",
|
||||
"suspend": "Suspender",
|
||||
"hibernate": "Hibernación",
|
||||
"title": "Menú de sesión"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "Redémarrer",
|
||||
"shutdown": "Éteindre",
|
||||
"suspend": "Mettre en veille",
|
||||
"hibernate": "Mise en veille prolongée",
|
||||
"title": "Menu de session"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "Opnieuw opstarten",
|
||||
"shutdown": "Uitschakelen",
|
||||
"suspend": "Onderbreken",
|
||||
"hibernate": "Slaperstand",
|
||||
"title": "Sessie-menu"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "Reiniciar",
|
||||
"shutdown": "Desligar",
|
||||
"suspend": "Suspender",
|
||||
"hibernate": "Hibernação",
|
||||
"title": "Menu da Sessão"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "Перезагрузить",
|
||||
"shutdown": "Выключить",
|
||||
"suspend": "Приостановить",
|
||||
"hibernate": "Гибернация",
|
||||
"title": "Меню сеанса"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "Yeniden başlat",
|
||||
"shutdown": "Bilgisayarı kapat",
|
||||
"suspend": "Askıya al",
|
||||
"hibernate": "Hazırda Bekletme",
|
||||
"title": "Oturum Menüsü"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "Перезавантажити",
|
||||
"shutdown": "Вимкнути",
|
||||
"suspend": "Призупинити",
|
||||
"hibernate": "Гібернація",
|
||||
"title": "Меню сеансу"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -653,6 +653,7 @@
|
||||
"reboot": "重启",
|
||||
"shutdown": "关机",
|
||||
"suspend": "挂起",
|
||||
"hibernate": "休眠",
|
||||
"title": "会话菜单"
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -219,6 +219,10 @@
|
||||
"action": "suspend",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"action": "hibernate",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"action": "reboot",
|
||||
"enabled": true
|
||||
@@ -318,4 +322,4 @@
|
||||
"battery": {
|
||||
"chargingMode": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ Singleton {
|
||||
"logout": "logout",
|
||||
"reboot": "refresh",
|
||||
"suspend": "player-pause",
|
||||
"hibernate": "zzz",
|
||||
"nightlight-on": "moon",
|
||||
"nightlight-off": "moon-off",
|
||||
"nightlight-forced": "moon-stars",
|
||||
|
||||
@@ -352,6 +352,9 @@ Singleton {
|
||||
}, {
|
||||
"action": "suspend",
|
||||
"enabled": true
|
||||
}, {
|
||||
"action": "hibernate",
|
||||
"enabled": true
|
||||
}, {
|
||||
"action": "reboot",
|
||||
"enabled": true
|
||||
|
||||
@@ -1188,6 +1188,54 @@ Loader {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 : 48
|
||||
radius: Settings.data.general.compactLockScreen ? 18 : 24
|
||||
color: hibernateButtonArea.containsMouse ? Color.mHover : "transparent"
|
||||
border.color: Color.mOutline
|
||||
border.width: 1
|
||||
|
||||
RowLayout {
|
||||
anchors.centerIn: parent
|
||||
spacing: 6
|
||||
|
||||
NIcon {
|
||||
icon: "hibernate"
|
||||
pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeM : Style.fontSizeL
|
||||
color: hibernateButtonArea.containsMouse ? Color.mOnHover : Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("session-menu.hibernate")
|
||||
pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeS : Style.fontSizeM
|
||||
color: hibernateButtonArea.containsMouse ? Color.mOnHover : Color.mOnSurfaceVariant
|
||||
font.weight: Font.Medium
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: hibernateButtonArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: CompositorService.hibernate()
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on border.color {
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 : 48
|
||||
|
||||
@@ -65,6 +65,11 @@ SmartPanel {
|
||||
"title": I18n.tr("session-menu.suspend"),
|
||||
"isShutdown": false
|
||||
},
|
||||
"hibernate": {
|
||||
"icon": "hibernate",
|
||||
"title": I18n.tr("session-menu.hibernate"),
|
||||
"isShutdown": false
|
||||
},
|
||||
"reboot": {
|
||||
"icon": "reboot",
|
||||
"title": I18n.tr("session-menu.reboot"),
|
||||
@@ -159,6 +164,9 @@ SmartPanel {
|
||||
CompositorService.suspend()
|
||||
}
|
||||
break
|
||||
case "hibernate":
|
||||
CompositorService.hibernate()
|
||||
break
|
||||
case "reboot":
|
||||
CompositorService.reboot()
|
||||
break
|
||||
|
||||
@@ -22,6 +22,11 @@ ColumnLayout {
|
||||
"text": I18n.tr("session-menu.suspend"),
|
||||
"enabled": true,
|
||||
"required": false
|
||||
}, {
|
||||
"id": "hibernate",
|
||||
"text": I18n.tr("session-menu.hibernate"),
|
||||
"enabled": true,
|
||||
"required": false
|
||||
}, {
|
||||
"id": "reboot",
|
||||
"text": I18n.tr("session-menu.reboot"),
|
||||
|
||||
@@ -342,6 +342,11 @@ Singleton {
|
||||
Quickshell.execDetached(["sh", "-c", "systemctl suspend || loginctl suspend"])
|
||||
}
|
||||
|
||||
function hibernate() {
|
||||
Logger.i("Compositor", "Hibernate requested")
|
||||
Quickshell.execDetached(["sh", "-c", "systemctl hibernate || loginctl hibernate"])
|
||||
}
|
||||
|
||||
function lockAndSuspend() {
|
||||
Logger.i("Compositor", "Lock and suspend requested")
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user