Add TDP presets to GUI
This commit is contained in:
parent
2a93b1ab66
commit
a188201f82
24
scripts/tdp
24
scripts/tdp
|
@ -228,13 +228,17 @@ gui_handler() {
|
||||||
elif (is_help $@); then
|
elif (is_help $@); then
|
||||||
print_help "gui"
|
print_help "gui"
|
||||||
else
|
else
|
||||||
|
# Enables graphical sudo prompt
|
||||||
export SUDO_ASKPASS="${script_dir}/gpd-sudo-prompt"
|
export SUDO_ASKPASS="${script_dir}/gpd-sudo-prompt"
|
||||||
export gui_used=1
|
export gui_used=1
|
||||||
while : ; do
|
while : ; do
|
||||||
|
# Clear variables
|
||||||
|
gui_tdp=""
|
||||||
# Contains some ugly hacks to "widen" the entries for the small GPD screen, might tweak later
|
# Contains some ugly hacks to "widen" the entries for the small GPD screen, might tweak later
|
||||||
gui_action=$(zenity --list --title="${gui_name}" --width=400 --height=300 $gui_options --text="Chose action to perform:" --hide-column=1 --column="" --column="Action"\
|
gui_action=$(zenity --list --title="${gui_name}" --width=400 --height=350 $gui_options --text="Chose action to perform:" --hide-column=1 --column="" --column="Action"\
|
||||||
check "`printf "\n Check current TDP\n "`" \
|
check "`printf "\n Check current TDP\n "`" \
|
||||||
set "`printf "\n Set new TDP (requires sudo password)\n "`" \
|
preset "`printf "\n Change TDP (requires sudo password)\n "`" \
|
||||||
|
set "`printf "\n Set custom TDP (requires sudo password)\n "`" \
|
||||||
exit "`printf "\n Exit TDP Manager\n "`")
|
exit "`printf "\n Exit TDP Manager\n "`")
|
||||||
|
|
||||||
case $gui_action in
|
case $gui_action in
|
||||||
|
@ -243,6 +247,21 @@ gui_handler() {
|
||||||
gui_msg "$($command_name check --detail)"
|
gui_msg "$($command_name check --detail)"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
"preset")
|
||||||
|
gui_tdp=$(
|
||||||
|
zenity --list --title "${gui_name}" --width=400 --height=350 $gui_options --text="Chose TDP to set:" --hide-column=1 --column="" --column="Wattage" \
|
||||||
|
8 "`printf "\n 8W (Ultra-low, for simple 2D games)\n "`" \
|
||||||
|
12 "`printf "\n 12W (Low power)\n "`" \
|
||||||
|
15 "`printf "\n 15W (Balanced)\n "`" \
|
||||||
|
20 "`printf "\n 20W (High power)\n "`" \
|
||||||
|
28 "`printf "\n 28W (Max power / Docked)\n "`"
|
||||||
|
)
|
||||||
|
echo $gui_tdp
|
||||||
|
if ! [ -z $gui_tdp ]; then
|
||||||
|
gui_msg "$(tdp set $gui_tdp --detail)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
"set")
|
"set")
|
||||||
gui_tdp=$(gui_read "Please enter TDP")
|
gui_tdp=$(gui_read "Please enter TDP")
|
||||||
|
|
||||||
|
@ -265,6 +284,7 @@ gui_handler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Command handler
|
# Command handler
|
||||||
|
# This checks which command was entered and forwards all other arguments to it
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
||||||
"check" | "c")
|
"check" | "c")
|
||||||
|
|
Loading…
Reference in New Issue