diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index 497f4fcc..a40c3374 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -652,7 +652,8 @@ "logout": "Abmelden", "reboot": "Neu starten", "shutdown": "Herunterfahren", - "suspend": "Ruhezustand", + "suspend": "Energiesparmodus", + "hibernate": "Ruhezustand", "title": "Sitzungsmenü" }, "settings": { diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 5e649837..5c4ab9f1 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -653,6 +653,7 @@ "reboot": "Reboot", "shutdown": "Shutdown", "suspend": "Suspend", + "hibernate": "Hibernate", "title": "Session Menu" }, "settings": { diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index 2c85f07a..76decb25 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -653,6 +653,7 @@ "reboot": "Reiniciar", "shutdown": "Apagar", "suspend": "Suspender", + "hibernate": "Hibernación", "title": "Menú de sesión" }, "settings": { diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index d1fd83d3..6f0a1bae 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -653,6 +653,7 @@ "reboot": "Redémarrer", "shutdown": "Éteindre", "suspend": "Mettre en veille", + "hibernate": "Mise en veille prolongée", "title": "Menu de session" }, "settings": { diff --git a/Assets/Translations/nl.json b/Assets/Translations/nl.json index b2752ea2..f1f74974 100644 --- a/Assets/Translations/nl.json +++ b/Assets/Translations/nl.json @@ -653,6 +653,7 @@ "reboot": "Opnieuw opstarten", "shutdown": "Uitschakelen", "suspend": "Onderbreken", + "hibernate": "Slaperstand", "title": "Sessie-menu" }, "settings": { diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index aa3f25e7..fac180ae 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -653,6 +653,7 @@ "reboot": "Reiniciar", "shutdown": "Desligar", "suspend": "Suspender", + "hibernate": "Hibernação", "title": "Menu da Sessão" }, "settings": { diff --git a/Assets/Translations/ru.json b/Assets/Translations/ru.json index 7d0b2859..45bb6fe6 100644 --- a/Assets/Translations/ru.json +++ b/Assets/Translations/ru.json @@ -653,6 +653,7 @@ "reboot": "Перезагрузить", "shutdown": "Выключить", "suspend": "Приостановить", + "hibernate": "Гибернация", "title": "Меню сеанса" }, "settings": { diff --git a/Assets/Translations/tr.json b/Assets/Translations/tr.json index a9b5aa7a..9fafd582 100644 --- a/Assets/Translations/tr.json +++ b/Assets/Translations/tr.json @@ -653,6 +653,7 @@ "reboot": "Yeniden başlat", "shutdown": "Bilgisayarı kapat", "suspend": "Askıya al", + "hibernate": "Hazırda Bekletme", "title": "Oturum Menüsü" }, "settings": { diff --git a/Assets/Translations/uk-UA.json b/Assets/Translations/uk-UA.json index 077e6781..e8eb376a 100644 --- a/Assets/Translations/uk-UA.json +++ b/Assets/Translations/uk-UA.json @@ -653,6 +653,7 @@ "reboot": "Перезавантажити", "shutdown": "Вимкнути", "suspend": "Призупинити", + "hibernate": "Гібернація", "title": "Меню сеансу" }, "settings": { diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index bfc896e4..c72c6728 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -653,6 +653,7 @@ "reboot": "重启", "shutdown": "关机", "suspend": "挂起", + "hibernate": "休眠", "title": "会话菜单" }, "settings": { diff --git a/Assets/settings-default.json b/Assets/settings-default.json index 1c1806f3..d7f03eff 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -219,6 +219,10 @@ "action": "suspend", "enabled": true }, + { + "action": "hibernate", + "enabled": true + }, { "action": "reboot", "enabled": true @@ -318,4 +322,4 @@ "battery": { "chargingMode": 0 } -} \ No newline at end of file +} diff --git a/Commons/IconsTabler.qml b/Commons/IconsTabler.qml index 32512878..fa0f029d 100644 --- a/Commons/IconsTabler.qml +++ b/Commons/IconsTabler.qml @@ -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", diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 28045d96..43e04798 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -352,6 +352,9 @@ Singleton { }, { "action": "suspend", "enabled": true + }, { + "action": "hibernate", + "enabled": true }, { "action": "reboot", "enabled": true diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index 4c87d1ca..4bf8b4d5 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -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 diff --git a/Modules/Panels/SessionMenu/SessionMenu.qml b/Modules/Panels/SessionMenu/SessionMenu.qml index 3fe9441e..b72d0200 100644 --- a/Modules/Panels/SessionMenu/SessionMenu.qml +++ b/Modules/Panels/SessionMenu/SessionMenu.qml @@ -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 diff --git a/Modules/Panels/Settings/Tabs/SessionMenuTab.qml b/Modules/Panels/Settings/Tabs/SessionMenuTab.qml index 4301cde0..267aa5b4 100644 --- a/Modules/Panels/Settings/Tabs/SessionMenuTab.qml +++ b/Modules/Panels/Settings/Tabs/SessionMenuTab.qml @@ -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"), diff --git a/Services/Compositor/CompositorService.qml b/Services/Compositor/CompositorService.qml index 0ce10ffa..069e468d 100644 --- a/Services/Compositor/CompositorService.qml +++ b/Services/Compositor/CompositorService.qml @@ -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 {