From afcadb86d78f272fbf0cf6bac9d009ee973535e3 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Tue, 11 Nov 2025 07:09:43 -0500 Subject: [PATCH] Autoformatting --- Modules/Bar/Widgets/KeepAwake.qml | 9 +++----- Services/Power/IdleInhibitorService.qml | 28 ++++++++----------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/Modules/Bar/Widgets/KeepAwake.qml b/Modules/Bar/Widgets/KeepAwake.qml index 0aa69f5c..6d065812 100644 --- a/Modules/Bar/Widgets/KeepAwake.qml +++ b/Modules/Bar/Widgets/KeepAwake.qml @@ -37,15 +37,12 @@ Item { BarPill { id: pill - text: IdleInhibitorService.timeout == null ? "" : - Time.formatVagueHumanReadableDuration(IdleInhibitorService.timeout) + text: IdleInhibitorService.timeout == null ? "" : Time.formatVagueHumanReadableDuration(IdleInhibitorService.timeout) density: Settings.data.bar.density oppositeDirection: BarService.getPillDirection(root) icon: IdleInhibitorService.isInhibited ? "keep-awake-on" : "keep-awake-off" - tooltipText: IdleInhibitorService.isInhibited ? - I18n.tr("tooltips.disable-keep-awake") : - I18n.tr("tooltips.enable-keep-awake") + tooltipText: IdleInhibitorService.isInhibited ? I18n.tr("tooltips.disable-keep-awake") : I18n.tr("tooltips.enable-keep-awake") onClicked: IdleInhibitorService.manualToggle() forceOpen: IdleInhibitorService.timeout !== null forceClose: IdleInhibitorService.timeout == null @@ -54,7 +51,7 @@ Item { // the offset makes scrolling down feel symmetrical to scrolling up var timeout = IdleInhibitorService.timeout - (delta < 0 ? 60 : 0) if (timeout == null || timeout < 600) { - delta = 60 // <= 10m, increment at 1m interval + delta = 60 // <= 10m, increment at 1m interval } else if (timeout >= 600 && timeout < 1800) { delta = 300 // >= 10m, increment at 5m interval } else if (timeout >= 1800 && timeout < 3600) { diff --git a/Services/Power/IdleInhibitorService.qml b/Services/Power/IdleInhibitorService.qml index dc670e25..1148134d 100644 --- a/Services/Power/IdleInhibitorService.qml +++ b/Services/Power/IdleInhibitorService.qml @@ -187,25 +187,25 @@ Singleton { function changeTimeout(delta) { if (timeout == null && delta < 0) { // no inhibitor, ignored - return; + return } if (timeout == null && delta > 0) { // enable manual inhibitor and set timeout - addManualInhibitor(timeout + delta); - return; + addManualInhibitor(timeout + delta) + return } if (timeout + delta <= 0) { // disable manual inhibitor - removeManualInhibitor(); - return; + removeManualInhibitor() + return } if (timeout + delta > 0) { // change timeout - addManualInhibitor(timeout + delta); - return; + addManualInhibitor(timeout + delta) + return } } @@ -219,11 +219,7 @@ Singleton { if (activeInhibitors.includes("manual")) { removeInhibitor("manual") - ToastService.showNotice( - I18n.tr("tooltips.keep-awake"), - I18n.tr("toast.keep-awake.disabled"), - "keep-awake-off" - ) + ToastService.showNotice(I18n.tr("tooltips.keep-awake"), I18n.tr("toast.keep-awake.disabled"), "keep-awake-off") Logger.i("IdleInhibitor", "Manual inhibition disabled") } } @@ -231,11 +227,7 @@ Singleton { function addManualInhibitor(timeoutSec) { if (!activeInhibitors.includes("manual")) { addInhibitor("manual", "Manually activated by user") - ToastService.showNotice( - I18n.tr("tooltips.keep-awake"), - I18n.tr("toast.keep-awake.enabled"), - "keep-awake-on" - ) + ToastService.showNotice(I18n.tr("tooltips.keep-awake"), I18n.tr("toast.keep-awake.enabled"), "keep-awake-on") } if (timeoutSec === null && timeout === null) { @@ -258,8 +250,6 @@ Singleton { } } - - // Clean up on shutdown Component.onDestruction: { stopInhibition()