From nobody Sun Aug 06 21:57:13 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RJtbF3n86z4mV4L; Sun, 6 Aug 2023 21:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RJtbF2rKLz3GqB; Sun, 6 Aug 2023 21:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691359033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k5ipA8o3CBk/wG+LQ0CCAX9Q+9eYx8cc+SRMp886lAw=; b=aK8M0Anv5itQbEOavfqIKKlLT2JKykKdksVZV9vwk1wtc17/MSd2Lc4wiEcKf8pj1LOeA1 asDyojk2FXSnpVA4bzy9dMYqbmzKD/yTCdsdg63ZIVShVMOZkHqyeDyYPqNXFLxFP421ed C69pgKmkUOH9zkhBXrRGkUClQ8NqSPBqP9gpKSTOQUZAUYzHOFzvsXQ5A6LoFdFrBgLM8j ovW2krCfU0B5NT7iLUDznB0OuxMSbHTMYEUVBkPZRpAoNQUNMee+mBfiGKdElhSX7EF8Ja TtyfJmx5EIdbDOlfH8ePOvSlby5IGfD00nNiIFgNeqVqQgVjxgZ1/X4982X8rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691359033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k5ipA8o3CBk/wG+LQ0CCAX9Q+9eYx8cc+SRMp886lAw=; b=oCV6g62brwokavWh8JWtqG0StXL04ysmfmVudnCfL5s49lHfeKhlA/YlXY7gVuNyUDHWr6 unmNm4kl1mwjECUns8N2nd+hWsaGo1r50MGxXLMwv21u0zAct5ju3z91xvp9vJBWF5poIu 2SzDL7uqItOAkwTHM2vmCuiQHGTJ7rAGZMNE5bHZl2GOgQbGIb2EK5SkdUF9N0UTQt9nqc HF62Q+5LPtCi5SPF5xyLJYEoTuR/kYbrwfRRm34+hah190ECaClH8osABLaXKyXFHcfoQ4 Zn6HV3y9oSq28jiD63me/sUc87jIYUki0TPN2ifR5ccpU5tvcg9gOesFMTBV5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691359033; a=rsa-sha256; cv=none; b=jUsFx+uk1iK+iEDR9XL4tqaH30L3XJXL3y/+13fCb46lebTGbMNsggTcsAu4g3A5WUA2bY /KZyhpqUoyTyLrB2htu8oPbG8dCJCgwKW4NJ/hYHxFt4YCx8zxJd/zUrhQjXUxVXWnh633 NhBm2eel5VO/Q4bJq7c+8tGPHuqg9LJwlGmsywS7xxAqOCKqSiVxkA+BnVGQA+lb/eeSkS 9miusE2pZVzZHE1XGyPd5zS64/AmKJj+tVCangvRQ9w906kwLPVFg5SVxdZ0l9eaUMKHy0 tAtjPOggUQoRcQFUX8HxBpshk1k4EydlqTajP9xtuIjhfzT47MYMA/wm4Yt6Lw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RJtbF1b3dzBnl; Sun, 6 Aug 2023 21:57:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 376LvD3V076539; Sun, 6 Aug 2023 21:57:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 376LvDsa076538; Sun, 6 Aug 2023 21:57:13 GMT (envelope-from git) Date: Sun, 6 Aug 2023 21:57:13 GMT Message-Id: <202308062157.376LvDsa076538@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: "Jason W. Bacon" Subject: git: fb487e6a5610 - main - x11/lumina-core: Expand battery icon notification List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jwb X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb487e6a5610c48317b320ea961fc81b04eb77e3 Auto-Submitted: auto-generated The branch main has been updated by jwb: URL: https://cgit.FreeBSD.org/ports/commit/?id=fb487e6a5610c48317b320ea961fc81b04eb77e3 commit fb487e6a5610c48317b320ea961fc81b04eb77e3 Author: Jason W. Bacon AuthorDate: 2023-08-06 21:53:16 +0000 Commit: Jason W. Bacon CommitDate: 2023-08-06 21:57:11 +0000 x11/lumina-core: Expand battery icon notification Add additional color changes to yellow and orange during discharge for earlier warning about low battery. Add change to green at 80% during charge to indicate optimal time to unplug for minimizing battery wear. --- x11/lumina-core/Makefile | 2 +- .../files/patch-lumina-desktop_LSession.cpp | 114 +++++++++++++++++++++ ...mina-desktop_panel-plugins_battery_LBattery.cpp | 31 ++++++ 3 files changed, 146 insertions(+), 1 deletion(-) diff --git a/x11/lumina-core/Makefile b/x11/lumina-core/Makefile index cecdd3d46352..6bc0f8b6d5dc 100644 --- a/x11/lumina-core/Makefile +++ b/x11/lumina-core/Makefile @@ -1,7 +1,7 @@ PORTNAME= lumina-core DISTVERSIONPREFIX= v DISTVERSION= 1.6.2 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= x11 MAINTAINER= jwb@FreeBSD.org diff --git a/x11/lumina-core/files/patch-lumina-desktop_LSession.cpp b/x11/lumina-core/files/patch-lumina-desktop_LSession.cpp new file mode 100644 index 000000000000..a1246116a3ce --- /dev/null +++ b/x11/lumina-core/files/patch-lumina-desktop_LSession.cpp @@ -0,0 +1,114 @@ +--- lumina-desktop/LSession.cpp.orig 2021-12-26 02:33:45 UTC ++++ lumina-desktop/LSession.cpp +@@ -97,46 +97,96 @@ LSession::~LSession(){ + //Static function so everything can get the same icon name + QString LSession::batteryIconName(int charge, bool charging){ + int icon = -1; +- if (charge > 90) { icon = 4; } +- else if (charge > 70) { icon = 3; } +- else if (charge > 20) { icon = 2; } +- else if (charge > 5) { icon = 1; } +- else if (charge > 0 ) { icon = 0; } +- if(charging){ icon = icon+10; } ++ ++ // Add 5% in order to round to nearest 10% ++ // E.g. 85% to 94% will show 90% icon ++ icon = (charge + 5) / 10; ++ ++ //if (charge > 90) { icon = 4; } ++ //else if (charge > 70) { icon = 3; } ++ //else if (charge > 20) { icon = 2; } ++ //else if (charge > 5) { icon = 1; } ++ //else if (charge > 0 ) { icon = 0; } ++ ++ if(charging){ icon += 11; } ++ ++ // Some icons may not be available for some themes, so build a list ++ // of alternatives + QStringList iconList; + switch (icon) { ++ ++ // Draining + case 0: +- iconList << "battery-20" << "battery-020" << "battery-empty" << "battery-caution"; ++ iconList << "battery-00" << "battery-000" << "battery-empty" << "battery-caution"; + break; + case 1: +- iconList << "battery-40" << "battery-040" << "battery-low" << "battery-caution"; ++ iconList << "battery-10" << "battery-010" << "battery-low" << "battery-caution"; + break; + case 2: +- iconList << "battery-60" << "battery-060" << "battery-good"; ++ iconList << "battery-20" << "battery-020" << "battery-low" << "battery-caution"; + break; + case 3: +- iconList << "battery-80" << "battery-080" << "battery-good"; ++ iconList << "battery-30" << "battery-030" << "battery-low" << "battery-caution"; + break; + case 4: +- iconList << "battery-100" << "battery-full"; ++ iconList << "battery-40" << "battery-040" << "battery-good"; + break; ++ case 5: ++ iconList << "battery-50" << "battery-050" << "battery-good"; ++ break; ++ case 6: ++ iconList << "battery-60" << "battery-060" << "battery-good"; ++ break; ++ case 7: ++ iconList << "battery-70" << "battery-070" << "battery-good"; ++ break; ++ case 8: ++ iconList << "battery-80" << "battery-080" << "battery-good"; ++ break; ++ case 9: + case 10: ++ iconList << "battery-100" << "battery-full"; ++ break; ++ ++ // Charging ++ case 11: ++ iconList << "battery-00-charging" << "battery-000-charging" << "battery-empty-charging" << "battery-caution-charging" ++ << "battery-charging-00" << "battery-charging-000" << "battery-charging-empty" << "battery-charging-caution"; ++ break; ++ case 12: ++ iconList << "battery-01-charging" << "battery-010-charging" << "battery-empty-charging" << "battery-caution-charging" ++ << "battery-charging-01" << "battery-charging-010" << "battery-charging-empty" << "battery-charging-caution"; ++ break; ++ case 13: + iconList << "battery-20-charging" << "battery-020-charging" << "battery-empty-charging" << "battery-caution-charging" + << "battery-charging-20" << "battery-charging-020" << "battery-charging-empty" << "battery-charging-caution"; + break; +- case 11: ++ case 14: ++ iconList << "battery-30-charging" << "battery-030-charging" << "battery-low-charging" << "battery-caution-charging" ++ << "battery-charging-30" << "battery-charging-030" << "battery-charging-low" << "battery-charging-caution"; ++ break; ++ case 15: + iconList << "battery-40-charging" << "battery-040-charging" << "battery-low-charging" << "battery-caution-charging" + << "battery-charging-40" << "battery-charging-040" << "battery-charging-low" << "battery-charging-caution"; + break; +- case 12: ++ case 16: ++ iconList << "battery-50-charging" << "battery-050-charging" << "battery-low-charging" << "battery-caution-charging" ++ << "battery-charging-50" << "battery-charging-050" << "battery-charging-low" << "battery-charging-caution"; ++ break; ++ case 17: + iconList << "battery-60-charging" << "battery-060-charging" << "battery-good-charging" + << "battery-charging-60" << "battery-charging-060" << "battery-charging-good"; + break; +- case 13: ++ case 18: ++ iconList << "battery-70-charging" << "battery-070-charging" << "battery-good-charging" ++ << "battery-charging-70" << "battery-charging-070" << "battery-charging-good"; ++ break; ++ case 19: + iconList << "battery-80-charging" << "battery-080-charging" << "battery-good-charging" + << "battery-charging-80" << "battery-charging-080" << "battery-charging-good"; + break; +- case 14: ++ case 20: ++ case 21: + if(charge==100){ iconList << "battery-full-charged"; } + iconList << "battery-100-charging" << "battery-full-charging" + << "battery-charging-100" << "battery-charging-full"; diff --git a/x11/lumina-core/files/patch-lumina-desktop_panel-plugins_battery_LBattery.cpp b/x11/lumina-core/files/patch-lumina-desktop_panel-plugins_battery_LBattery.cpp new file mode 100644 index 000000000000..2fdcf84b90c6 --- /dev/null +++ b/x11/lumina-core/files/patch-lumina-desktop_panel-plugins_battery_LBattery.cpp @@ -0,0 +1,31 @@ +--- lumina-desktop/panel-plugins/battery/LBattery.cpp.orig 2021-12-26 02:33:45 UTC ++++ lumina-desktop/panel-plugins/battery/LBattery.cpp +@@ -35,7 +35,7 @@ void LBattery::updateBattery(bool force){ + QString batt_icon = LSession::batteryIconName(charge, charging); + if(iconOld != batt_icon){ + label->setPixmap( QIcon::fromTheme(batt_icon).pixmap(label->size()) ); +- if(charge <= 5 && !charging){ ++ if(charge <= 10 && !charging){ + //Play some audio warning chime when + bool playaudio = sessionsettings->value("PlayBatteryLowAudio",true).toBool(); + if( playaudio ){ +@@ -47,8 +47,17 @@ void LBattery::updateBattery(bool force){ + iconOld = batt_icon; //save for later + } + +- if(charge<=5 && !charging){ label->setStyleSheet("QLabel{ background: red;}"); } +- else if(charge>98 && charging){ label->setStyleSheet("QLabel{ background: green;}"); } ++ /* ++ * Use 40% - 80% rule for icon notifications. Lithium batteries last ++ * longer if kept between 40% and 80% charge as much as possible. ++ * Turn icon yellow when charge drops to 40% and green when charge ++ * rises to 80%. This will help the user maintain their battery ++ * in an optimal way. ++ */ ++ if(charge<=20 && !charging){ label->setStyleSheet("QLabel{ background: red;}"); } ++ else if(charge<=30 && !charging){ label->setStyleSheet("QLabel{ background: orange;}"); } ++ else if(charge<=40 && !charging){ label->setStyleSheet("QLabel{ background: yellow;}"); } ++ else if(charge>80 && charging){ label->setStyleSheet("QLabel{ background: green;}"); } + else{ label->setStyleSheet("QLabel{ background: transparent;}"); } + + //Now update the display