2021-05-21 08:17:28 +00:00
# Scripts
2021-05-20 10:58:07 +00:00
2021-05-21 08:17:28 +00:00
A collection of scripts for the GPD Win 3. Mostly to minimize the reuqired typing on the keyboard.
2021-05-20 10:58:07 +00:00
2021-05-20 10:59:03 +00:00
To install scripts, copy them somewhere on your Win 3, then add them to your path. This is done by adding a line to the end of `~/.bashrc`
2021-05-22 21:46:28 +00:00
I recommend cloning the repo as `~/.local/gpd-win3` for all the scripts to work properly.
2021-05-20 10:58:07 +00:00
2021-05-23 09:26:39 +00:00
## Quick install
2021-05-21 08:17:28 +00:00
2021-05-21 09:25:59 +00:00
To quickly install the scripts, paste this block into a terminal on your GPD Win 3:
2021-05-21 08:17:28 +00:00
2021-05-21 08:20:20 +00:00
```bash
2021-05-21 09:25:59 +00:00
if [ -z $(which git 2>/dev/null) ]; then
printf "\n$(tput setaf 1)-- We didn't find git! Is it installed? --$(tput sgr0)\n\n"
printf "On Ubuntu and similar distros, git can be installed with the following command:\n"
printf " $(tput setaf 2)sudo apt install git$(tput sgr0)\n\n"
printf "Please try again after installing git.\n\n"
else
printf "$(tput setaf 2)-- Installing scripts --$(tput sgr0)\n"
mkdir -p ~/.local
git clone https://gitea.quad.moe/quad/win3-resources.git ~/.local/gpd-win3
echo -e "\n# GPD Win 3 scripts\nPATH=\"\${PATH}:\${HOME}/.local/gpd-win3/scripts\"" >> ~/.bashrc
printf "$(tput setaf 2)-- Install finished. Please open a new terminal to use the scripts --$(tput sgr0)\n"
fi
2021-05-20 10:58:07 +00:00
```
2021-05-21 09:25:59 +00:00
To update, run:
2021-05-20 10:58:07 +00:00
2021-05-21 09:25:59 +00:00
```bash
2021-05-21 19:36:53 +00:00
gpd-script-update
2021-05-21 09:25:59 +00:00
```
2021-05-20 10:58:07 +00:00
2021-05-22 21:06:57 +00:00
### "Install" TDP manager
2021-05-22 21:08:42 +00:00
The TDP manager has a GUI. This can be added to your application menu by running the following command:
2021-05-22 21:06:57 +00:00
2021-05-23 09:26:39 +00:00
```bash
2021-05-22 21:06:57 +00:00
tdp-gui-install
```
2021-05-22 21:58:13 +00:00
You might have to log out and back in before the TDP Manager appears in your application menu.
2021-05-22 21:06:57 +00:00
2021-05-21 09:25:59 +00:00
### Manual install
2021-05-20 10:58:07 +00:00
2021-05-23 09:18:06 +00:00
- Clone the repository somewhere (preferably `~/.local/gpd-win3` )
2021-05-21 09:25:59 +00:00
- Ensure the scripts folder is in your PATH
- (Optional) add `tdp check` to your .bashrc, which will display TDP every time you open a terminal
2021-05-23 09:26:39 +00:00
## Uninstall
If you wish to uninstall the scripts follow the instructions in this block:
```bash
# Edit your .bashrc and remove the GPD-related entries at the bottom
nano ~/.bashrc
# Delete the repository
rm -rf ~/.local/gpd-win3
# Delete the application shortcut for the TDP manager (If installed)
rm -rf ~/.local/share/applications/tdp-gui.desktop
# Delete the systemd service (If installed)
sudo systemctl disable --now tdp-set.service
sudo rm -rf /etc/systemd/system/tdp-set.service
```
2021-05-21 09:25:59 +00:00
## TDP
2021-05-22 17:26:32 +00:00
Lets you easily set the TDP via the `intel_rapl` driver.
Also has a basic GUI available.
2021-05-20 12:32:25 +00:00
2021-05-22 23:21:11 +00:00
TDP is the number of watts the Intel chip is allowed to use.
You would typically want to change this to fit your desired balance of performance and battery life. Or to use different amounts of power when docked or handheld.
2021-05-21 09:25:59 +00:00
2021-05-20 11:02:12 +00:00
For details on how to use, run `tdp help` .
2021-05-20 10:58:07 +00:00
2021-05-21 09:25:59 +00:00
Example commands:
2021-05-20 10:58:07 +00:00
2021-05-21 08:20:20 +00:00
```bash
2021-05-21 09:25:59 +00:00
# Print help
tdp help
2021-05-22 17:26:32 +00:00
# Launch GUI
2021-05-22 17:26:47 +00:00
tdp gui
2021-05-22 17:26:32 +00:00
2021-05-21 09:25:59 +00:00
# Check TDP
2021-05-20 10:58:07 +00:00
tdp check
# Set TDP to 8W
tdp set 8
2021-05-21 09:25:59 +00:00
# Set both PL1 and PL2 to 15W
tdp set 15 --same --detail
2021-05-20 10:58:07 +00:00
```
2021-05-20 12:42:47 +00:00
### Setting TDP at boot
2021-05-21 09:25:59 +00:00
Install the service using the following command: `cp ~/.local/gpd-win3/scripts/tdp-set.service /etc/systemd/system/`
2021-05-20 12:42:47 +00:00
2021-05-21 09:25:59 +00:00
Run `nano /etc/systemd/system/tdp-set.service` and edit the `ExecStart=` line so it points to the correct place and enter the TDP you want at the end:
2021-05-20 12:42:47 +00:00
2021-05-21 09:25:59 +00:00
```
ExecStart=/home/< username > /.local/gpd-win3/scripts/tdp set 12
```
2021-05-20 12:42:47 +00:00
Enable the service:
2021-05-21 09:25:59 +00:00
```bash
2021-05-20 12:42:47 +00:00
sudo systemctl deamon-reload
sudo systemctl enable tdp-set.service
```
2021-05-21 09:25:59 +00:00
Reboot your Win 3, then run `tdp check` to check that TDP was set correctly.
2021-05-21 08:04:36 +00:00
2021-05-21 08:20:20 +00:00
## Touch fix
The script `touch-fix` unloads, then loads the touchscreen modules needed by the Win 3. This makes the touchscreen work, but only until next reboot. Useful until a permanent fix is available.
2021-05-21 08:04:36 +00:00
2021-05-21 08:20:20 +00:00
Example commands:
2021-05-21 08:04:36 +00:00
2021-05-21 08:20:20 +00:00
```bash
# Reload touchscreen module
touch-fix
2021-05-21 19:12:47 +00:00
```
## GPD Prompt
This is a customized version of my bash prompt that adds a TDP display after the hostname:
2021-05-21 19:17:54 +00:00
![Screenshot of bash prompt in action ](../img/gpd-prompt.png )
2021-05-21 19:12:47 +00:00
This script collection must be installed for it to work.
To use it, open your `~/.bashrc` file and add the following line:
```
source gpd-prompt
```