win3-resources/scripts/README.md

118 lines
3.1 KiB
Markdown

# Scripts
A collection of scripts for the GPD Win 3. Mostly to minimize the reuqired typing on the keyboard.
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`
### Quick install
To quickly install the scripts, paste this block into a terminal on your GPD Win 3:
```bash
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
```
To update, run:
```bash
gpd-script-update
```
### "Install" TDP manager
The TDP manager has a GUI. This can be installed into your application menu like other software by running the following command after installing this script collection:
```
tdp-gui-install
```
You should then find the TDP manager in your application menu like any other piece of software.
### Manual install
- Clone the repository somewhere
- 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
## TDP
Lets you easily set the TDP via the `intel_rapl` driver.
Also has a basic GUI available.
By default, PL2 (short-term peak) will be 2W higher than PL1.
For details on how to use, run `tdp help`.
Example commands:
```bash
# Print help
tdp help
# Launch GUI
tdp gui
# Check TDP
tdp check
# Set TDP to 8W
tdp set 8
# Set both PL1 and PL2 to 15W
tdp set 15 --same --detail
```
### Setting TDP at boot
Install the service using the following command: `cp ~/.local/gpd-win3/scripts/tdp-set.service /etc/systemd/system/`
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:
```
ExecStart=/home/<username>/.local/gpd-win3/scripts/tdp set 12
```
Enable the service:
```bash
sudo systemctl deamon-reload
sudo systemctl enable tdp-set.service
```
Reboot your Win 3, then run `tdp check` to check that TDP was set correctly.
## 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.
Example commands:
```bash
# Reload touchscreen module
touch-fix
```
## GPD Prompt
This is a customized version of my bash prompt that adds a TDP display after the hostname:
![Screenshot of bash prompt in action](../img/gpd-prompt.png)
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
```