From 7b34561a5f031b97fb4e54c5b8c0c2505e7f9578 Mon Sep 17 00:00:00 2001 From: Pedrozzz0 Date: Fri, 21 May 2021 09:57:51 -0300 Subject: [PATCH] Fixup another annoying syntax error on kingauto and improve a bit Signed-off-by: Pedrozzz0 --- kingauto | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/kingauto b/kingauto index bf53665..40761de 100644 --- a/kingauto +++ b/kingauto @@ -24,59 +24,69 @@ get_scrn_state(){ ( while true; do for gpid in $(pgrep netease) $(pgrep com2us) $(pgrep zuuks) $(pgrep junegaming) $(pgrep junesoftware) $(pgrep sozap) $(pgrep dotemu) $(pgrep playables) $(pgrep playrisedigital) $(pgrep rockstar) $(pgrep blackpanther) $(pgrep noodlecake) $(pgrep linegames) $(pgrep kleientertainment) $(pgrep agaming) $(pgrep generagames) $(pgrep astragon) $(pgrep chucklefish) $(pgrep t2kgames) $(pgrep t2ksports) $(pgrep turner) $(pgrep uplayonline) $(pgrep pubg) $(pgrep dreamotion) $(pgrep snailgames) $(pgrep dexintgames) $(pgrep haegin) $(pgrep panzerdog) $(pgrep igg) $(pgrep gtarcade) $(pgrep naxon) $(pgrep mame4droid) $(pgrep kakaogames) $(pgrep telltalegames) $(pgrep seleuco) $(pgrep innersloth) $(pgrep kiloo) $(pgrep imaginalis) $(pgrep refuelgames) $(pgrep scottgames) $(pgrep clickteam) $(pgrep minigames) $(pgrep headupgames) $(pgrep mobigames) $(pgrep callofduty) $(pgrep ubisoft) $(pgrep ppsspp) $(pgrep cf) $(pgrep feralinteractive) $(pgrep riotgames) $(pgrep playgendary) $(pgrep joymax) $(pgrep deadeffect) $(pgrep blackdesertm) $(pgrep firsttouchgames) $(pgrep standoff2) $(pgrep criticalops) $(pgrep wolvesinteractive) $(pgrep gamedevltd) $(pgrep mojang) $(pgrep miHoYo) $(pgrep miniclip) $(pgrep moontoon) $(pgrep gameloft) $(pgrep netmarble) $(pgrep yoozoogames) $(pgrep eyougame) $(pgrep asphalt) $(pgrep dhlove) $(pgrep fifamobile) $(pgrep wildrift) $(pgrep freefireth) $(pgrep activision) $(pgrep konami) $(pgrep gamevil) $(pgrep madfingergames) $(pgrep supercell) $(pgrep ngame) $(pgrep garena); do - if [[ "$(grep $gpid $toptdir)" ]]; then + if [[ "$(grep $gpid $toptdir)" ]]; then . "$MODPATH"/libs/libktsr.sh + kmsg3 "" kmsg "User is playing, applied gaming profile" kmsg3 "" renice -n -20 -p $gpid gaming sleep 30 for spid in $(pgrep whatsapp) $(pgrep musically) $(pgrep adobe) $(pgrep telegram) $(pgrep netflix) $(pgrep wemesh) $(pgrep discord) $(pgrep youtube) $(pgrep facebook) $(pgrep chrome) $(pgrep browser) $(pgrep instagram) $(pgrep docs) $(pgrep twitch); do - elif [[ "$(grep $gpid $toptdir)" ]]; then + if [[ "$(grep $spid $toptdir)" ]]; then . "$MODPATH"/libs/libktsr.sh + kmsg3 "" kmsg "User is using social media, and etc apps. Applied balanced profile" kmsg3 "" renice -n -9 -p $spid balanced sleep 30 for bpid in $(pgrep geekbench) $(pgrep androbench2) $(pgrep kinemaster) $(pgrep futuremark) $(pgrep cputhrottlingtest) $(pgrep camera) $(pgrep cam) $(pgrep antutu); do - elif [[ "$(grep $bpid $toptdir)" /dev/stune/top-app/tasks ]]; then + if [[ "$(grep $bpid $toptdir)" ]]; then . "$MODPATH"/libs/libktsr.sh + kmsg3 "" kmsg "User is running benchmark / heavy apps. Applied extreme profile" kmsg3 "" renice -n -20 -p $bpid extreme sleep 30 - elif [[ "$(cat /sys/class/leds/lcd-backlight/brightness)" ]] || [[ "$(cat /sys/class/backlight/panel*-backlight/brightness)" == "0" ]] || [[ get_scrn_state && $is_scrn_on == "0" ]]; then + fi + done + fi + done + fi + done + if [[ "$(cat /sys/class/leds/lcd-backlight/brightness)" ]] || [[ "$(cat /sys/class/backlight/panel*-backlight/brightness)" == "0" ]] || [[ get_scrn_state && $is_scrn_on == "0" ]]; then . "$MODPATH"/libs/libktsr.sh + kmsg3 "" kmsg "Device screen is turned off. Applied battery profile, extended script check time" kmsg3 "" battery sleep 100 elif [[ "$bstatus" == "Charging" ]]; then . "$MODPATH"/libs/libktsr.sh + kmsg3 "" kmsg "Device is charging, trying to reduce battery cycles by applying battery profile and extending check time" kmsg3 "" battery sleep 100 - elif [[ "$gbpercentage" -le "20" ]] && [[ "$bstatus" == "Discharging" ]]; then + elif [[ "$gbpercentage" -lt "20" ]] && [[ "$bstatus" == "Discharging" ]]; then . "$MODPATH"/libs/libktsr.sh + kmsg3 "" kmsg "Device battery is lower than 20%, applied battery profile and extended script check time to reduce battery comsumption" kmsg3 "" battery sleep 100 else . "$MODPATH"/libs/libktsr.sh + kmsg3 "" kmsg "No considerable usage found. Applied latency profile" kmsg3 "" latency sleep 15 fi done - done - done - done - + if [[ $avail_ram -lt $full_ram ]] || [[ $avail_ram -eq $full_ram ]]; then kmsg "Device ram is almost fully in use, dropping caches to free some RAM" kmsg3 ""