summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authornemesys2022-07-19 01:04:53 -0400
committernemesys2022-07-19 01:04:53 -0400
commit52675b5c2fec3c2602df8be2c4fa9642def96ee6 (patch)
treee8cf73837312dee6dd876dba2a83bfee6d427ad4
parent795d57b341aa110a6c2e046c87fea9abe8bedd7c (diff)
downloadaur-52675b5c2fec3c2602df8be2c4fa9642def96ee6.tar.gz
Some cosmetic updates to assist functionality
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--lenovo-ice-mode111
3 files changed, 60 insertions, 59 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 71524afc2828..071e163eefc5 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,10 +1,10 @@
pkgbase = lenovo-ice-mode
pkgdesc = Set Lenovo Intelligent Cooling Engine via acpi_call. Laptops with this feature available in the bios can use lenovo-ice-mode to switch between Intelligent Cooling, Extreme Performance, and Battery Saving mode.
pkgver = 1.0
- pkgrel = 2
+ pkgrel = 3
arch = any
depends = acpi_call
source = lenovo-ice-mode
- sha512sums = a27fd6a80fed4359211b7cb4d8b4b5e1e1e22ce8ff80599ed8f0ec5d8b03750ff54a3c4c0f6a03ce39fde4588470edf3ac92086b1ee4fecdf8b3ec4bd15eabc4
+ sha512sums = 6ae4173fc9a9f948d7522d0a4ddaf4991e9c79e685faaa9338bbb6ca5956a2fbea1389283f606b21d2be2b9b005d4b122b786667361161af54426ad127dd7e58
pkgname = lenovo-ice-mode
diff --git a/PKGBUILD b/PKGBUILD
index 1506a9087cac..6b134d4ba01e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,12 +2,12 @@
pkgname=lenovo-ice-mode
pkgver=1.0
-pkgrel=2
+pkgrel=3
pkgdesc='Set Lenovo Intelligent Cooling Engine via acpi_call. Laptops with this feature available in the bios can use lenovo-ice-mode to switch between Intelligent Cooling, Extreme Performance, and Battery Saving mode.'
arch=('any')
depends=(acpi_call)
source=(lenovo-ice-mode)
-sha512sums=('a27fd6a80fed4359211b7cb4d8b4b5e1e1e22ce8ff80599ed8f0ec5d8b03750ff54a3c4c0f6a03ce39fde4588470edf3ac92086b1ee4fecdf8b3ec4bd15eabc4')
+sha512sums=('6ae4173fc9a9f948d7522d0a4ddaf4991e9c79e685faaa9338bbb6ca5956a2fbea1389283f606b21d2be2b9b005d4b122b786667361161af54426ad127dd7e58')
package() {
mkdir -p "${pkgdir}"/usr/local/bin
install -Dm755 lenovo-ice-mode "${pkgdir}/usr/local/bin"
diff --git a/lenovo-ice-mode b/lenovo-ice-mode
index d386a9c7d491..5fdf1f792d20 100644
--- a/lenovo-ice-mode
+++ b/lenovo-ice-mode
@@ -1,69 +1,70 @@
#!/bin/bash
-# Script to apply desired Lenovo bios System Cooling mode using acpi_call
+#Script to apply desired Lenovo bios System Cooling mode using acpi_call
+
+clrarr=( "$(tput bold ; tput setaf 5)" "$(tput bold ; tput setaf 6)" "$(tput bold ; tput setaf 4)" "$(tput bold ; tput setaf 1)" "$(tput setab 5 ; tput bold ; tput setaf 6)" "$(tput setab 1)" "$(tput sgr0)" )
+pnk=0 ; lcn=1 ; lbl=2 ; lrd=3 ; purbg=4 ; redbg=5 ; noc=6 #no color
+
if [ -a /proc/acpi/call ]; then
-curcoolmode() {
- echo '\_SB.PCI0.LPC0.EC0.FCMO' > /proc/acpi/call
- cat /proc/acpi/call | cut -d '' -f1
-}
+ curcoolmode() {
+ echo '\_SB.PCI0.LPC0.EC0.FCMO' > /proc/acpi/call
+ cat /proc/acpi/call | cut -d '' -f1
+ }
+
+ hcoolmodearr=( "${clrarr[$pnk]}Intelligent Cooling${clrarr[$noc]}" "${clrarr[$lrd]}Extreme Performance${clrarr[$noc]}" "${clrarr[$lcn]}Battery Saving${clrarr[$noc]}" )
+ hcoolmodei=0 ; hcoolmodep=1 ; hcoolmodeb=2
-hcoolmodearr=( "\033[35;1;1mIntelligent Cooling\033[0m" "\033[31;1;1mExtreme Performance\033[0m" "\033[36;1;1mBattery Saving\033[0m" )
-hcoolmodei=0
-hcoolmodep=1
-hcoolmodeb=2
+ modepusharr=( "0x000FB001" "0x0012B001" "0x0013B001" )
+ modepushi=0 ; modepushp=1 ; modepushb=2
-modepusharr=( "0x000FB001" "0x0012B001" "0x0013B001" )
-modepushi=0
-modepushp=1
-modepushb=2
+ noticetext="${clrarr[$purbg]}Notice:${clrarr[$noc]}"
-noticetext="\033[36;1;45mNotice:\033[0m"
-helptext="$hcurrmode \n$noticetext \033[34;1;1mProvide a case insensitive option to set system cooling mode: \n -i for "${hcoolmodearr[$hcoolmodei]}" \033[34;1;1m \n -p for "${hcoolmodearr[$hcoolmodep]}" \033[34;1;1m \n -b for "${hcoolmodearr[$hcoolmodeb]}" \033[0m \n "
+ helptext="$hcurrmode \n$noticetext ${clrarr[$lbl]}Provide a case insensitive option to set system cooling mode:\n\n ${clrarr[$pnk]}[-i${clrarr[$pnk]}] ${clrarr[$lbl]}for "${hcoolmodearr[$hcoolmodei]}" \n ${clrarr[$lrd]}[-p${clrarr[$lrd]}] ${clrarr[$lbl]}for "${hcoolmodearr[$hcoolmodep]}" \n ${clrarr[$lcn]}[-b${clrarr[$lcn]}] ${clrarr[$lbl]}for "${hcoolmodearr[$hcoolmodeb]}" ${clrarr[$noc]} \n "
-case `curcoolmode` in
- 0x0)
- coolmodei="${hcoolmodearr[$hcoolmodei]}"
- coolmode="$coolmodei"
- ;;
- 0x1)
- coolmodep="${hcoolmodearr[$hcoolmodep]}"
- coolmode="$coolmodep"
- ;;
- 0x2)
- coolmodeb="${hcoolmodearr[$hcoolmodeb]}"
- coolmode="$coolmodeb"
- ;;
- esac
+ case `curcoolmode` in
+ 0x0)
+ coolmodei="${hcoolmodearr[$hcoolmodei]}"
+ coolmode="$coolmodei"
+ ;;
+ 0x1)
+ coolmodep="${hcoolmodearr[$hcoolmodep]}"
+ coolmode="$coolmodep"
+ ;;
+ 0x2)
+ coolmodeb="${hcoolmodearr[$hcoolmodeb]}"
+ coolmode="$coolmodeb"
+ ;;
+ esac
-hcurrmode="\n$noticetext \033[34;1;1mCurrent cooling mode is set as $coolmode \n"
+ hcurrmode="\n$noticetext ${clrarr[$lbl]}Current cooling mode is set as $coolmode ${clrarr[$noc]}\n"
-[ $# -eq 0 ] && { echo -e "$hcurrmode"; echo -e "$helptext"; exit 1; }
+ [ $# -eq 0 ] && { echo -e "$hcurrmode"; echo -e "$helptext"; exit 1; }
-while getopts ':[-][iI][pP][bB]' optgiv
-do
- case "$optgiv" in
- [iI] )
- modepush="${modepusharr[$modepushi]}"
- hmodepush="${hcoolmodearr[$hcoolmodei]}"
- ;;
- [pP] )
- modepush="${modepusharr[$modepushp]}"
- hmodepush="${hcoolmodearr[$hcoolmodep]}"
- ;;
- [bB] )
- modepush="${modepusharr[$modepushb]}"
- hmodepush="${hcoolmodearr[$hcoolmodeb]}"
- ;;
- \? )
- echo -e "$hcurrmode"
- echo -e "$helptext"
- exit;;
- esac
+ while getopts ':[iI][pP][bB]' optgiv
+ do
+ case "$optgiv" in
+ [iI] )
+ modepush="${modepusharr[$modepushi]}"
+ hmodepush="${hcoolmodearr[$hcoolmodei]}"
+ ;;
+ [pP] )
+ modepush="${modepusharr[$modepushp]}"
+ hmodepush="${hcoolmodearr[$hcoolmodep]}"
+ ;;
+ [bB] )
+ modepush="${modepusharr[$modepushb]}"
+ hmodepush="${hcoolmodearr[$hcoolmodeb]}"
+ ;;
+ \? )
+ echo -e "$hcurrmode"
+ echo -e "$helptext"
+ exit;;
+ esac
echo "\_SB.PCI0.LPC0.EC0.VPC0.DYTC $modepush" > /proc/acpi/call
- echo -e "\n$noticetext\033[34;1;1m Successfully updated system cooling from $coolmode \033[34;1;1mto $hmodepush\033[34;1;1m mode. \033[0m \n"
- exit
-done
+ echo -e "\n$noticetext ${clrarr[$lbl]}Successfully updated system cooling from $coolmode ${clrarr[$lbl]}to $hmodepush ${clrarr[$lbl]}mode.${clrarr[$noc]}\n"
+ exit
+ done
else
- echo -e "\n\033[41;1;1mERROR: No /proc/acpi/call found! Please make sure acpi_call is installed and has been modprobed. \033[0m \n"
+ echo -e "\n${clrarr[$redbg]}ERROR: No /proc/acpi/call found! Please make sure acpi_call is installed and has been modprobed. ${clrarr[$noc]}\n"
fi