diff --git a/99-plasma-pstate b/99-plasma-pstate deleted file mode 100644 index 70a42ab..0000000 --- a/99-plasma-pstate +++ /dev/null @@ -1 +0,0 @@ -%sudo ALL=NOPASSWD: /usr/share/plasma/plasmoids/gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh diff --git a/README.md b/README.md index 23910a0..343d7dc 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,5 @@ # Intel P-state and CPUFreq Manager Widget -```diff --Important -``` -as of October 11, 2020, I'm not willing to maintain this widget anymore. I will maintain it based only to my personal needs. I thank you for your support and feedback all this time. Hope the community will take over from here and make the widget even better than it is now. - ## What it is Intel P-state and CPUFreq Manager is a KDE Plasma widget in order to control the frequencies of Intel CPUs and their integrated GPUs for any modern Intel @@ -33,6 +28,10 @@ through [libsmbios library](https://github.com/dell/libsmbios). Intel P-state and CPUFreq Manager Widget with Nvidia PowerMizer Settings +4. MSI Cooler Boost + +- This assume that you already have seen if your laptop is supported by ISW tool, already seen https://github.com/YoyPa/isw/blob/master/README.md and set up it, and isw is in the executable path. + ## What it isn't This is just a GUI widget and it is not meant to replace @@ -74,9 +73,10 @@ sudo apt install linux-tools-generic linux-tools-`uname -r` Assuming that you have checked out the latest code, you just need to run the following commands as root: ``` -sudo kpackagetool5 -g -t Plasma/Applet -u gr.ictpro.jsalatas.plasma.pstate +sudo kpackagetool5 -g -t Plasma/Applet -u org.thefreecircle.mibofra.plasma.pstate -sudo chmod 755 /usr/share/plasma/plasmoids/gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh +sudo chmod 755 /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/set_prefs.sh +sudo chmod 755 /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/get_thermal.sh ``` @@ -86,10 +86,17 @@ especially in relation to similar to Dell's Thermal Management Feature that may be available in other hardware platforms. ## Issues -The widget uses a shell script that needs to be run as root user (sudo) and which apparently floods your log files with security related messages as described in [issue #16](https://github.com/jsalatas/plasma-pstate/issues/16). -If you want to get rid of these messages, please see a workaround at +Using PolKit, I don't see any log flood a the moment. + +If it's not your case, plese read: https://github.com/jsalatas/plasma-pstate/wiki/Too-many-messages-in-system-log + +For option with a slider, please, be sure to slide them and not click on an arbitrary point of the slider. This will ensure that, the plasmoid slider is working fine, getting the preference issued, avoiding it to bug plasmashell, the plasmoid, or the panel where it is docked. And surely, making polkit agent asking the password for setting the preference, as expected. + +## Info -https://github.com/jsalatas/plasma-pstate/wiki/Too-many-messages-in-system-log +The original author is maintaining the plasmoid up to his needs, see the head of: https://github.com/jsalatas/plasma-pstate/blob/master/README.md , +also because there are efforts to have hardware profiles directly in powerdevil and kcm like in gnome with https://gitlab.freedesktop.org/hadess/power-profiles-daemon . +Anyway, some tools can be still useful for some users, like me, who added the possibility to set the number of online cpus, or other tools that are out of scope of powerdevil and kcm itself. So I'm trying to keep at least it up to date, in a working state with latest KDE releases, trying to adding new functions if needed. With patience and time, also trying to redesing the ui, as the original author wanted: https://github.com/jsalatas/plasma-pstate/issues/40 (or the space on the desktop for the tools will decrease). diff --git a/install.sh b/install.sh index 7a06a82..9e1f7dc 100755 --- a/install.sh +++ b/install.sh @@ -5,24 +5,13 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi -SUDOERS_FILE="99-plasma-pstate" +kpackagetool5 -g -t Plasma/Applet -i org.thefreecircle.mibofra.plasma.pstate -cp -R ${SUDOERS_FILE} /etc/sudoers.d/ -kpackagetool5 -g -t Plasma/Applet -i gr.ictpro.jsalatas.plasma.pstate +chmod 755 /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/set_prefs.sh +chmod 755 /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/get_thermal.sh -chmod 755 /usr/share/plasma/plasmoids/gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh - -chown root:root /etc/sudoers.d/${SUDOERS_FILE} -chmod 400 /etc/sudoers.d/${SUDOERS_FILE} - -# Test for wheel group instead of sudo -# this is the case of arch based distros -wheelgroup=`grep wheel /etc/group | wc -l` -sudogroup=`grep sudo /etc/group | wc -l` -if [ "$wheelgroup" -eq "1" ] && [ "$sudogroup" -eq "0" ]; then - # seems to be safe enough: there is a wheel group and not a sudo group - sed -i 's/sudo/wheel/' /etc/sudoers.d/${SUDOERS_FILE} -fi +cp org.thefreecircle.mibofra.plasma.pstate/contents/code/org.thefreecircle.mibofra.plasma.pstate.get-thermal.policy /usr/share/polkit-1/actions/ +cp org.thefreecircle.mibofra.plasma.pstate/contents/code/org.thefreecircle.mibofra.plasma.pstate.set-prefs.policy /usr/share/polkit-1/actions/ echo -e "\nSetup complete." exit 0 diff --git a/org.thefreecircle.mibofra.plasma.pstate/contents/code/get_thermal.sh b/org.thefreecircle.mibofra.plasma.pstate/contents/code/get_thermal.sh new file mode 100755 index 0000000..159dac8 --- /dev/null +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/code/get_thermal.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +smbios-thermal-ctl -g \ No newline at end of file diff --git a/org.thefreecircle.mibofra.plasma.pstate/contents/code/org.thefreecircle.mibofra.plasma.pstate.get-thermal.policy b/org.thefreecircle.mibofra.plasma.pstate/contents/code/org.thefreecircle.mibofra.plasma.pstate.get-thermal.policy new file mode 100644 index 0000000..1360f5a --- /dev/null +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/code/org.thefreecircle.mibofra.plasma.pstate.get-thermal.policy @@ -0,0 +1,17 @@ + + + + + + Authentication is required to run Plasma P-state (Get thermal info) + + no + no + yes + + /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/get_thermal.sh + + + diff --git a/org.thefreecircle.mibofra.plasma.pstate/contents/code/org.thefreecircle.mibofra.plasma.pstate.set-prefs.policy b/org.thefreecircle.mibofra.plasma.pstate/contents/code/org.thefreecircle.mibofra.plasma.pstate.set-prefs.policy new file mode 100644 index 0000000..5b9b2c3 --- /dev/null +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/code/org.thefreecircle.mibofra.plasma.pstate.set-prefs.policy @@ -0,0 +1,17 @@ + + + + + + Authentication is required to run Plasma P-state + + no + no + auth_admin + + /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/set_prefs.sh + + + diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh b/org.thefreecircle.mibofra.plasma.pstate/contents/code/set_prefs.sh similarity index 56% rename from gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh rename to org.thefreecircle.mibofra.plasma.pstate/contents/code/set_prefs.sh index e017ac7..7fba7e6 100755 --- a/gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/code/set_prefs.sh @@ -1,9 +1,25 @@ -#!/bin/bash - -INTEL_PSTATE=/sys/devices/system/cpu/intel_pstate -CPU_MIN_PERF=$INTEL_PSTATE/min_perf_pct -CPU_MAX_PERF=$INTEL_PSTATE/max_perf_pct -CPU_TURBO=$INTEL_PSTATE/no_turbo +#!/usr/bin/env bash + +ACPI_CPU=/sys/devices/system/cpu +if [ -d /sys/devices/system/cpu/cpufreq ]; then + INTEL_PSTATE=$ACPI_CPU/cpufreq + CPU_MIN_PERF=$INTEL_PSTATE/policy0/scaling_min_freq + CPU_MAX_PERF=$INTEL_PSTATE/policy0/scaling_max_freq + CPU_MIN_PERF_SET=$INTEL_PSTATE/policy*/scaling_min_freq + CPU_MAX_PERF_SET=$INTEL_PSTATE/policy*/scaling_max_freq + CPU_MIN_FREQ=$INTEL_PSTATE/policy0/cpuinfo_min_freq + CPU_MAX_FREQ=$INTEL_PSTATE/policy0/cpuinfo_max_freq + CPU_TURBO=$INTEL_PSTATE/boost + AMD=1 +else + INTEL_PSTATE=$ACPI_CPU/intel_pstate + CPU_MIN_PERF=$INTEL_PSTATE/min_perf_pct + CPU_MAX_PERF=$INTEL_PSTATE/max_perf_pct + CPU_TURBO=$INTEL_PSTATE/no_turbo + AMD=0 +fi +CPU_TOTAL_AVAILABLE=$(nproc --all) +CPU_ONLINE=$(nproc) GPU=/sys/class/drm/card0 GPU_MIN_FREQ=$GPU/gt_min_freq_mhz @@ -27,7 +43,7 @@ check_lg_drivers() { } check_dell_thermal () { - smbios-thermal-ctl -g > /dev/null 2>&1 + /usr/bin/pkexec /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/get_thermal.sh > /dev/null 2>&1 OUT=$? if [ $OUT -eq 0 ]; then return 0 @@ -46,17 +62,44 @@ check_nvidia () { fi } +check_isw () { + isw=`command -v isw` + if [ -z "${isw}" ]; then + return 1 + else + return 0 + fi +} + set_cpu_min_perf () { minperf=$1 - if [ -n "$minperf" ] && [ "$minperf" != "0" ]; then + if [ -n "$minperf" ] && [ "$minperf" != "0" -a "$AMD" == "0" -o "$AMD" == "1" ]; then + if [ "$AMD" == "0" ]; then printf '%s\n' "$minperf" > $CPU_MIN_PERF; 2> /dev/null + else + minfreq=$(cat $CPU_MIN_FREQ) + maxfreq=$(cat $CPU_MAX_FREQ) + freq=$((($maxfreq-$minfreq)*$minperf/100 + $minfreq)) + for d in $CPU_MIN_PERF_SET; do + printf '%s\n' "$freq" > $d; 2> /dev/null + done + fi fi } set_cpu_max_perf () { maxperf=$1 if [ -n "$maxperf" ] && [ "$maxperf" != "0" ]; then + if [ "$AMD" == "0" ]; then printf '%s\n' "$maxperf" > $CPU_MAX_PERF; 2> /dev/null + else + minfreq=$(cat $CPU_MIN_FREQ) + maxfreq=$(cat $CPU_MAX_FREQ) + freq=$((($maxfreq-$minfreq)*$maxperf/100 + $minfreq)) + for d in $CPU_MAX_PERF_SET; do + printf '%s\n' "$freq" > $d; 2> /dev/null + done + fi fi } @@ -64,13 +107,47 @@ set_cpu_turbo () { turbo=$1 if [ -n "$turbo" ]; then if [ "$turbo" == "true" ]; then + if [ "$AMD" == "0" ]; then printf '0\n' > $CPU_TURBO; 2> /dev/null + else + printf '1\n' > $CPU_TURBO; 2> /dev/null + fi else + if [ "$AMD" == "0" ]; then printf '1\n' > $CPU_TURBO; 2> /dev/null + else + printf '0\n' > $CPU_TURBO; 2> /dev/null + fi fi fi } +set_cpu_state () { + num=$1 + num_off=$[$CPU_TOTAL_AVAILABLE-$num] + counter=1 + limit=$[$num-1] + all_off=$[$CPU_TOTAL_AVAILABLE-1] + if [ -n "$num" ] && [ "$num" != "0" ]; then + if [ "$num" -ne "1" ]; then + while [ "$counter" -le "$limit" ]; do + printf '1\n' > $ACPI_CPU/cpu$counter/online; 2> /dev/null + counter=$[$counter+1] + done + limit=$[$limit+$num_off] + while [ "$counter" -le "$limit" ]; do + printf '0\n' > $ACPI_CPU/cpu$counter/online; 2> /dev/null + counter=$[$counter+1] + done + else + while [ "$counter" -le "$all_off" ]; do + printf '0\n' > $ACPI_CPU/cpu$counter/online; 2> /dev/null + counter=$[$counter+1] + done + fi + fi +} + set_gpu_min_freq () { gpuminfreq=$1 if [ -n "$gpuminfreq" ] && [ "$gpuminfreq" != "0" ]; then @@ -139,9 +216,9 @@ set_lg_fan_mode() { enabled=$1 if [ -n "$enabled" ]; then if [ "$enabled" == "true" ]; then - printf '0\n' > $LG_FAN_MODE; 2> /dev/null + printf '0' > $LG_FAN_MODE; 2> /dev/null else - printf '1\n' > $LG_FAN_MODE; 2> /dev/null + printf '1' > $LG_FAN_MODE; 2> /dev/null fi fi } @@ -161,21 +238,47 @@ set_lg_usb_charge() { fi } +set_cooler_boost () { + boost=$1 + if [ -n "$boost" ]; then + if [ "$boost" == "true" ]; then + printf '1\n' > /run/isw_cooler_boost; 2> /dev/null + isw -b on; 2> /dev/null + else + printf '0\n' > /run/isw_cooler_boost; 2> /dev/null + isw -b off; 2> /dev/null + fi + fi +} + read_all () { -cpu_min_perf=`cat $CPU_MIN_PERF` -cpu_max_perf=`cat $CPU_MAX_PERF` +if [ "$AMD" == "0" ]; then + cpu_min_perf=`cat $CPU_MIN_PERF` + cpu_max_perf=`cat $CPU_MAX_PERF` +else + cpu_min_freq=`cat $CPU_MIN_FREQ` + cpu_max_freq=`cat $CPU_MAX_FREQ` + max=$(cat $CPU_MAX_PERF) + min=$(cat $CPU_MIN_PERF) + cpu_max_perf=$(((100+($max-$cpu_max_freq)*100/$cpu_max_freq))) + cpu_min_perf=$((($min-$cpu_min_freq)*100/$cpu_min_freq)) +fi +cpu_total_available=`echo $CPU_TOTAL_AVAILABLE` +cpu_online=`echo $CPU_ONLINE` cpu_turbo=`cat $CPU_TURBO` -if [ "$cpu_turbo" == "1" ]; then +if [ "$cpu_turbo" == "1" -a "$AMD" = "0" -o "$cpu_turbo" == "0" -a "$AMD" = "1" ]; then cpu_turbo="false" else cpu_turbo="true" fi -gpu_min_freq=`cat $GPU_MIN_FREQ` -gpu_max_freq=`cat $GPU_MAX_FREQ` -gpu_min_limit=`cat $GPU_MIN_LIMIT` -gpu_max_limit=`cat $GPU_MAX_LIMIT` -gpu_boost_freq=`cat $GPU_BOOST_FREQ` -gpu_cur_freq=`cat $GPU_CUR_FREQ` +if [ -f $GPU_MIN_FREQ ]; then + gpu_min_freq=`cat $GPU_MIN_FREQ` + gpu_max_freq=`cat $GPU_MAX_FREQ` + gpu_min_limit=`cat $GPU_MIN_LIMIT` + gpu_max_limit=`cat $GPU_MAX_LIMIT` + gpu_boost_freq=`cat $GPU_BOOST_FREQ` + gpu_cur_freq=`cat $GPU_CUR_FREQ` +fi cpu_governor=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor` energy_perf=`cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference` if [ -z "$energy_perf" ]; then @@ -189,7 +292,7 @@ if [ -z "$energy_perf" ]; then awk '{ printf "%s\n", $2; }' | head -n 1` 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]" ` + thermal_mode=`/usr/bin/pkexec /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/get_thermal.sh | 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 @@ -214,19 +317,36 @@ if check_lg_drivers; then fi if check_nvidia; then - powermizer=`nvidia-settings -q GpuPowerMizerMode | grep "Attribute 'GPUPowerMizerMode'" | awk -F "): " '{print $2}' | awk -F "." '{print $1}' ` + powermizer=`nvidia-settings -q GpuPowerMizerMode 2> /dev/null | grep "Attribute 'GPUPowerMizerMode'" | awk -F "): " '{print $2}' | awk -F "." '{print $1}' ` +fi + +if check_isw; then + if [[ ! -f /run/isw_cooler_boost ]]; then + cooler_boost="false" + else + cooler_boost=`cat /run/isw_cooler_boost` + if [ "$cooler_boost" == "1" ]; then + cooler_boost="true" + else + cooler_boost="false" + fi + fi fi json="{" json="${json}\"cpu_min_perf\":\"${cpu_min_perf}\"" json="${json},\"cpu_max_perf\":\"${cpu_max_perf}\"" json="${json},\"cpu_turbo\":\"${cpu_turbo}\"" -json="${json},\"gpu_min_freq\":\"${gpu_min_freq}\"" -json="${json},\"gpu_max_freq\":\"${gpu_max_freq}\"" -json="${json},\"gpu_min_limit\":\"${gpu_min_limit}\"" -json="${json},\"gpu_max_limit\":\"${gpu_max_limit}\"" -json="${json},\"gpu_boost_freq\":\"${gpu_boost_freq}\"" -json="${json},\"gpu_cur_freq\":\"${gpu_cur_freq}\"" +json="${json},\"cpu_total_available\":\"${cpu_total_available}\"" +json="${json},\"cpu_online\":\"${cpu_online}\"" +if [ -f $GPU_MIN_FREQ ]; then + json="${json},\"gpu_min_freq\":\"${gpu_min_freq}\"" + json="${json},\"gpu_max_freq\":\"${gpu_max_freq}\"" + json="${json},\"gpu_min_limit\":\"${gpu_min_limit}\"" + json="${json},\"gpu_max_limit\":\"${gpu_max_limit}\"" + json="${json},\"gpu_boost_freq\":\"${gpu_boost_freq}\"" + json="${json},\"gpu_cur_freq\":\"${gpu_cur_freq}\"" +fi json="${json},\"cpu_governor\":\"${cpu_governor}\"" json="${json},\"energy_perf\":\"${energy_perf}\"" if check_dell_thermal; then @@ -240,6 +360,9 @@ fi if check_nvidia; then json="${json},\"powermizer\":\"${powermizer}\"" fi +if check_isw; then + json="${json},\"cooler_boost\":\"${cooler_boost}\"" +fi json="${json}}" echo $json } @@ -257,6 +380,10 @@ case $1 in set_cpu_turbo $2 ;; + "-cpu-online") + set_cpu_state $2 + ;; + "-gpu-min-freq") set_gpu_min_freq $2 ;; @@ -297,6 +424,10 @@ case $1 in set_powermizer $2 ;; + "-cooler-boost") + set_cooler_boost $2 + ;; + "-read-all") read_all ;; @@ -306,6 +437,7 @@ case $1 in echo "1: set_prefs.sh [ -cpu-min-perf |" echo " -cpu-max-perf |" echo " -cpu-turbo |" + echo " -cpu-online |" echo " -gpu-min-freq |" echo " -gpu-max-freq |" echo " -gpu-boost-freq |" @@ -315,7 +447,8 @@ case $1 in echo " -lg-battery-charge-limit |" echo " -lg-fan-mode |" echo " -lg-usb-charge |" - echo " -powermizer ] value" + echo " -powermizer |" + echo " -cooler-boost ] value" echo "2: set_prefs.sh -read-all" exit 3 ;; diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/code/utils.js b/org.thefreecircle.mibofra.plasma.pstate/contents/code/utils.js similarity index 89% rename from gr.ictpro.jsalatas.plasma.pstate/contents/code/utils.js rename to org.thefreecircle.mibofra.plasma.pstate/contents/code/utils.js index db2d82d..1f73396 100644 --- a/gr.ictpro.jsalatas.plasma.pstate/contents/code/utils.js +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/code/utils.js @@ -60,6 +60,7 @@ var sensors = { 'cpu_cur_load': {'value': undefined, 'unit':'%', 'print': to_int}, 'cpu_cur_freq': {'value': undefined, 'unit':' MHz', 'print': to_int}, 'gpu_cur_freq': {'value': undefined, 'unit':' MHz', 'print': to_int}, + 'cpu_total_available': {'value': undefined, 'unit':'', 'print': to_int}, 'gpu_min_limit': {'value': undefined, 'unit':'', 'print': to_int}, 'gpu_max_limit': {'value': undefined, 'unit':'', 'print': to_int}, 'battery_percentage': {'value': undefined, 'unit': '%', 'print': to_int}, @@ -70,6 +71,7 @@ var sensors = { 'cpu_min_perf': {'value': undefined, 'unit':'%', 'print': to_int}, 'cpu_max_perf': {'value': undefined, 'unit':'%', 'print': to_int}, 'cpu_turbo': {'value': undefined, 'unit':'', 'print': to_bool}, + 'cpu_online': {'value': undefined, 'unit':'', 'print': to_int}, 'gpu_min_freq': {'value': undefined, 'unit':' MHz', 'print': to_int}, 'gpu_max_freq': {'value': undefined, 'unit':' MHz', 'print': to_int}, 'gpu_boost_freq': {'value': undefined, 'unit':' MHz', 'print': to_int}, @@ -79,14 +81,16 @@ var sensors = { '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}, - 'powermizer': {'value': undefined, 'unit':'', 'print': to_string}, + 'powermizer': {'value': undefined, 'unit':'', 'print': to_string}, + 'cooler_boost': {'value': undefined, 'unit':'', 'print': to_bool}, } var vendors = { 'dell': {'provides': ['thermal_mode']}, 'lg-laptop': {'provides': ['lg_battery_charge_limit', 'lg_usb_charge', 'lg_fan_mode']}, - 'nvidia': {'provides': ['powermizer']} + 'nvidia': {'provides': ['powermizer']}, + 'msi': {'provides': ['cooler_boost']} } var model = [ @@ -98,6 +102,9 @@ var model = [ {'type': 'slider', 'text': 'Max perf', 'min': 0, 'max': 100, 'sensor': 'cpu_max_perf'}, {'type': 'switch', 'text': 'Turbo', 'sensor': 'cpu_turbo'} ]}, + {'type': 'group', 'text': 'Online CPUs', 'items' :[ + {'type': 'slider', 'text': 'CPUs', 'min': 0, 'max': 'cpu_total_available', 'sensor': 'cpu_online'}, + ]}, {'type': 'group', 'text': 'GPU Frequencies', 'visible': 'showIntelGPU', 'items' :[ {'type': 'slider', 'text': 'Min freq', 'min': 'gpu_min_limit', 'max': 'gpu_max_limit', 'sensor': 'gpu_min_freq'}, {'type': 'slider', 'text': 'Max freq', 'min': 'gpu_min_limit', 'max': 'gpu_max_limit', 'sensor': 'gpu_max_freq'}, @@ -105,6 +112,8 @@ var model = [ ]}, {'type': 'radio', 'text': 'CPU Governor', 'sensor': 'cpu_governor', 'items' :[ {'symbol': 'a', 'text': 'Performance', 'sensor_value': 'performance'}, + {'symbol': 'k', 'text': 'Balance Performance', 'sensor_value': 'ondemand'}, + {'symbol': 'l', 'text': 'Balance Power', 'sensor_value': 'conservative'}, {'symbol': 'f', 'text': 'Powersave', 'sensor_value': 'powersave'} ]} ] @@ -155,6 +164,12 @@ var model = [ {'text': 'Auto', 'sensor_value': '2'} ]} ] + }, + {'type': 'header', 'text': 'MSI Settings', 'icon': 'b', + 'vendors': ['msi'], + 'items': [ + {'type': 'switch', 'text': 'Cooler Boost', 'sensor': 'cooler_boost'} + ] } ] diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/config/config.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/config/config.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/config/config.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/config/config.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/config/main.xml b/org.thefreecircle.mibofra.plasma.pstate/contents/config/main.xml similarity index 85% rename from gr.ictpro.jsalatas.plasma.pstate/contents/config/main.xml rename to org.thefreecircle.mibofra.plasma.pstate/contents/config/main.xml index 401291c..92de849 100644 --- a/gr.ictpro.jsalatas.plasma.pstate/contents/config/main.xml +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/config/main.xml @@ -15,8 +15,5 @@ true - - true - diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/font/plasma-pstate.ttf b/org.thefreecircle.mibofra.plasma.pstate/contents/font/plasma-pstate.ttf similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/font/plasma-pstate.ttf rename to org.thefreecircle.mibofra.plasma.pstate/contents/font/plasma-pstate.ttf diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/ComboBox.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/ComboBox.qml similarity index 98% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/ComboBox.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/ComboBox.qml index b37e1a2..4581aaa 100644 --- a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/ComboBox.qml +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/ComboBox.qml @@ -81,6 +81,6 @@ RowLayout { } } - Layout.minimumWidth: parent.width + Layout.minimumWidth: units.gridUnit * 4 } } diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/CompactRepresentation.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/CompactRepresentation.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/CompactRepresentation.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/CompactRepresentation.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/FullRepresentation.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/FullRepresentation.qml similarity index 94% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/FullRepresentation.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/FullRepresentation.qml index 1dfb139..36ebcbf 100644 --- a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/FullRepresentation.qml +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/FullRepresentation.qml @@ -62,15 +62,6 @@ Column { } } - Connections { - target: plasmoid.configuration - onUseSudoForReadingChanged: { - if(isReady) { - initialize() - } - } - } - function is_present(item_vendors) { if(item_vendors && item_vendors.length != 0) { for(var j=0; j< item_vendors.length; j++) { diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/Group.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/Group.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/Group.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/Group.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/Header.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/Header.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/Header.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/Header.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/PushButton.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/PushButton.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/PushButton.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/PushButton.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/Radio.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/Radio.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/Radio.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/Radio.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/Slider.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/Slider.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/Slider.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/Slider.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/Switch.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/Switch.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/Switch.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/Switch.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/config/ConfigGeneral.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/config/ConfigGeneral.qml similarity index 81% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/config/ConfigGeneral.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/config/ConfigGeneral.qml index 849adf4..e5e1041 100644 --- a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/config/ConfigGeneral.qml +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/config/ConfigGeneral.qml @@ -6,7 +6,6 @@ Item { property alias cfg_useDefaultIcon: useDefaultIconCheckbox.checked property alias cfg_showIntelGPU: showIntelGPUCheckbox.checked property string cfg_customIcon: plasmoid.configuration.customIcon - property alias cfg_useSudoForReading: useSudoForReadingCheckbox.checked GridLayout { Layout.fillWidth: true @@ -37,11 +36,5 @@ Item { text: i18n('Show Intel GPU') Layout.columnSpan: 2 } - - CheckBox { - id: useSudoForReadingCheckbox - text: i18n('Use sudo for reading values') - Layout.columnSpan: 2 - } } } diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/config/IconPicker.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/config/IconPicker.qml similarity index 100% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/config/IconPicker.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/config/IconPicker.qml diff --git a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/main.qml b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/main.qml similarity index 93% rename from gr.ictpro.jsalatas.plasma.pstate/contents/ui/main.qml rename to org.thefreecircle.mibofra.plasma.pstate/contents/ui/main.qml index 9573490..617ed3d 100644 --- a/gr.ictpro.jsalatas.plasma.pstate/contents/ui/main.qml +++ b/org.thefreecircle.mibofra.plasma.pstate/contents/ui/main.qml @@ -43,7 +43,7 @@ Item { property var sensors_model: Utils.get_sensors() property alias isReady: monitorDS.isReady property bool inTray: (plasmoid.parent === null || plasmoid.parent.objectName === 'taskItemContainer') - property var readCommand: (plasmoid.configuration.useSudoForReading ? 'sudo ' : '') + '/usr/share/plasma/plasmoids/gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh -read-all' + property var readCommand: '/usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/set_prefs.sh -read-all' function sensor_short_name(long_name) { var parts = long_name.split('/'); @@ -189,16 +189,6 @@ Item { interval: 2000 } - Connections { - target: plasmoid.configuration - onUseSudoForReadingChanged: { - monitorDS.commandSource = readCommand - monitorDS.connectedSources = []; - monitorDS.connectedSources.length = 0; - monitorDS.connectedSources.push(monitorDS.commandSource); - } - } - PlasmaCore.DataSource { id: monitorDS engine: 'executable' @@ -235,7 +225,7 @@ Item { id: updater engine: 'executable' - property string commandSource: 'sudo /usr/share/plasma/plasmoids/gr.ictpro.jsalatas.plasma.pstate/contents/code/set_prefs.sh -' + property string commandSource: '/usr/bin/pkexec /usr/share/plasma/plasmoids/org.thefreecircle.mibofra.plasma.pstate/contents/code/set_prefs.sh -' onNewData: { updater.connectedSources = [] diff --git a/gr.ictpro.jsalatas.plasma.pstate/metadata.desktop b/org.thefreecircle.mibofra.plasma.pstate/metadata.desktop similarity index 63% rename from gr.ictpro.jsalatas.plasma.pstate/metadata.desktop rename to org.thefreecircle.mibofra.plasma.pstate/metadata.desktop index c62923b..e89eb9a 100644 --- a/gr.ictpro.jsalatas.plasma.pstate/metadata.desktop +++ b/org.thefreecircle.mibofra.plasma.pstate/metadata.desktop @@ -4,13 +4,13 @@ Name=Intel P-state and CPUFreq Manager Icon=cpu Type=Service X-KDE-ParentApp= -X-KDE-PluginInfo-Author=John Salatas +X-KDE-PluginInfo-Author=Francesco Bonanno X-KDE-PluginInfo-Category=System Information -X-KDE-PluginInfo-Email=jsalatas@ictpro.gr +X-KDE-PluginInfo-Email=mibofra@thefreecircle.org X-KDE-PluginInfo-License=GPL2+ -X-KDE-PluginInfo-Name=gr.ictpro.jsalatas.plasma.pstate +X-KDE-PluginInfo-Name=org.thefreecircle.mibofra.plasma.pstate X-KDE-PluginInfo-Version=1.0.6 -X-KDE-PluginInfo-Website=https://jsalatas.ictpro.gr +X-KDE-PluginInfo-Website=https://github.com/mibofra/plasma-pstate X-KDE-ServiceTypes=Plasma/Applet X-Plasma-API=declarativeappletscript X-Plasma-MainScript=ui/main.qml diff --git a/uninstall.sh b/uninstall.sh index 2ca56b4..2156f3a 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -5,10 +5,10 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi -SUDOERS_FILE="/etc/sudoers.d/99-plasma-pstate" +kpackagetool5 -g -t Plasma/Applet -r org.thefreecircle.mibofra.plasma.pstate -rm -f ${SUDOERS_FILE} -kpackagetool5 -g -t Plasma/Applet -r gr.ictpro.jsalatas.plasma.pstate +rm /usr/share/polkit-1/actions/org.thefreecircle.mibofra.plasma.pstate.get-thermal.policy +rm /usr/share/polkit-1/actions/org.thefreecircle.mibofra.plasma.pstate.set-prefs.policy echo "Uninstall complete." exit 0