Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
added nvidia settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jsalatas committed Jul 5, 2019
1 parent 7eaad68 commit c3bb44c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
30 changes: 29 additions & 1 deletion gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ check_dell_thermal () {
fi
}

check_nvidia () {
nvidia-settings -q GpuPowerMizerMode > /dev/null 2>&1
OUT=$?
if [ $OUT -eq 0 ]; then
return 0
else
return 1
fi
}

set_cpu_min_perf () {
minperf=$1
if [ -n "$minperf" ] && [ "$minperf" != "0" ]; then
Expand Down Expand Up @@ -136,6 +146,10 @@ set_lg_fan_mode() {
fi
}

set_powermizer () {
nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=$1" 2> /dev/null
}

set_lg_usb_charge() {
enabled=$1
if [ -n "$enabled" ]; then
Expand Down Expand Up @@ -177,6 +191,7 @@ fi
if check_dell_thermal; then
thermal_mode=`smbios-thermal-ctl -g | grep -C 1 "Current Thermal Modes:" | tail -n 1 | awk '{$1=$1;print}' | sed "s/\t//g" | sed "s/ /-/g" | tr "[A-Z]" "[a-z]" `
fi

if check_lg_drivers; then
lg_battery_charge_limit=`cat $LG_BATTERY_CHARGE_LIMIT`
if [ "$lg_battery_charge_limit" == "80" ]; then
Expand All @@ -197,6 +212,11 @@ if check_lg_drivers; then
lg_fan_mode="true"
fi
fi

if check_nvidia; then
powermizer=`nvidia-settings -q GpuPowerMizerMode | grep "Attribute 'GPUPowerMizerMode'" | awk -F "): " '{print $2}' | awk -F "." '{print $1}' `
fi

json="{"
json="${json}\"cpu_min_perf\":\"${cpu_min_perf}\""
json="${json},\"cpu_max_perf\":\"${cpu_max_perf}\""
Expand All @@ -217,6 +237,9 @@ if check_lg_drivers; then
json="${json},\"lg_usb_charge\":\"${lg_usb_charge}\""
json="${json},\"lg_fan_mode\":\"${lg_fan_mode}\""
fi
if check_nvidia; then
json="${json},\"powermizer\":\"${powermizer}\""
fi
json="${json}}"
echo $json
}
Expand Down Expand Up @@ -270,6 +293,10 @@ case $1 in
set_lg_usb_charge $2
;;

"-powermizer")
set_powermizer $2
;;

"-read-all")
read_all
;;
Expand All @@ -287,7 +314,8 @@ case $1 in
echo " -thermal-mode |"
echo " -lg-battery-charge-limit |"
echo " -lg-fan-mode |"
echo " -lg-usb-charge ] value"
echo " -lg-usb-charge |"
echo " -powermizer ] value"
echo "2: set_prefs.sh -read-all"
exit 3
;;
Expand Down
17 changes: 15 additions & 2 deletions gr.ictpro.jsalatas.plasma.pstate/contents/code/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ var sensors = {
'thermal_mode': {'value': undefined, 'unit':'', 'print': to_string},
'lg_battery_charge_limit': {'value': undefined, 'unit':'', 'print': to_bool},
'lg_usb_charge': {'value': undefined, 'unit':'', 'print': to_bool},
'lg_fan_mode': {'value': undefined, 'unit':'', 'print': to_bool}
'lg_fan_mode': {'value': undefined, 'unit':'', 'print': to_bool},
'powermizer': {'value': undefined, 'unit':'', 'print': to_string},

}

var vendors = {
'dell': {'provides': ['thermal_mode']},
'lg-laptop': {'provides': ['lg_battery_charge_limit', 'lg_usb_charge', 'lg_fan_mode']}
'lg-laptop': {'provides': ['lg_battery_charge_limit', 'lg_usb_charge', 'lg_fan_mode']},
'nvidia': {'provides': ['powermizer']}
}

var model = [
Expand Down Expand Up @@ -142,6 +145,16 @@ var model = [
'items': [
{'type': 'switch', 'text': 'Silent Mode', 'sensor': 'lg_fan_mode'}
]
},
{'type': 'header', 'text': 'Nvidia Settings', 'icon': 'o',
'vendors': ['nvidia'],
'items': [
{'type': 'combobox', 'text': '', 'sensor': 'powermizer', 'items' :[
{'text': 'Adaptive', 'sensor_value': '0'},
{'text': 'Prefer Max Performance', 'sensor_value': '1'},
{'text': 'Auto', 'sensor_value': '2'}
]}
]
}
]

Expand Down
Binary file modified gr.ictpro.jsalatas.plasma.pstate/contents/font/plasma-pstate.ttf
Binary file not shown.

0 comments on commit c3bb44c

Please sign in to comment.