87 lines
No EOL
2.7 KiB
Bash
Executable file
87 lines
No EOL
2.7 KiB
Bash
Executable file
#!/bin/sh
|
||
|
||
# custom logic for waydroid-root.sh [PART 1]
|
||
if [ -z "$1" ]; then
|
||
echo "Subcommand needed, use \"${SCRIPT_LOCATION} help\" for help.";
|
||
exit 1;
|
||
fi
|
||
|
||
if [ "$1" == "help" ]; then
|
||
echo "params: rotate-normal|rotate-left-up|rotate-right-up|rotate-bottom-up|reset-volume|help";
|
||
exit 0;
|
||
fi
|
||
|
||
|
||
# from volume-root.sh (modified to allow an extra param from the user)
|
||
if [ -z "$2" ]; then
|
||
DIR="$HOME/.config/hypr/scripts"
|
||
SELF="$(realpath "$DIR/$(basename "$0")")"
|
||
|
||
if [ "$SELF" != "$(realpath "$0")" ]; then
|
||
echo "This script must exist inside of $DIR";
|
||
exit 1;
|
||
fi
|
||
else
|
||
if [ "root" != "$USER" ]; then
|
||
echo "Only root are allowed to arbitrarily specify the directory.";
|
||
exit 1;
|
||
fi
|
||
DIR=$2
|
||
SELF="Something went horribly wrong! You were assumed to be root in one check, but non-root by the next one.";
|
||
fi
|
||
|
||
if [ "root" != "$USER" ]; then
|
||
|
||
if [ "$SELF" != "$(realpath "$0")" ]; then
|
||
echo "This script must exist inside of $DIR";
|
||
exit 1;
|
||
fi
|
||
|
||
exec sudo "$SELF" "$1" "$DIR";
|
||
echo "NOTE: You should never see this message!"
|
||
exit 1;
|
||
fi
|
||
|
||
# custom logic for waydroid-root.sh [PART 2]
|
||
|
||
if [ "$1" == "rotate-normal" ]; then
|
||
waydroid shell settings put system user_rotation 0
|
||
exit;
|
||
fi
|
||
|
||
if [ "$1" == "rotate-right-up" ]; then
|
||
waydroid shell settings put system user_rotation 1
|
||
exit;
|
||
fi
|
||
|
||
if [ "$1" == "rotate-bottom-up" ]; then
|
||
waydroid shell settings put system user_rotation 2
|
||
exit;
|
||
fi
|
||
|
||
if [ "$1" == "rotate-left-up" ]; then
|
||
waydroid shell settings put system user_rotation 3
|
||
exit;
|
||
fi
|
||
|
||
# Commented-out because it doesn't work. I can QUERY those values just fine, and the returned numbers correspond to what I put in my setting on the Android side - but when I try to SET them, nothing happens. I have no idea why, but it is what it is.
|
||
#if [ "$1" == "reset-volume" ]; then
|
||
# # These are the „everything is maxed out” values. Don't ask me why are they so random; I didn't make Android.
|
||
# waydroid shell settings put system volume_alarm 6
|
||
# waydroid shell settings put system volume_alarm_speaker 7
|
||
# waydroid shell settings put system volume_bluetooth_sco 7
|
||
# waydroid shell settings put system volume_music 5
|
||
# waydroid shell settings put system volume_music_speaker 15
|
||
# waydroid shell settings put system volume_music_usb_headset 3
|
||
# waydroid shell settings put system volume_notification 5
|
||
# waydroid shell settings put system volume_notification_speaker 7
|
||
# waydroid shell settings put system volume_ring 5
|
||
# waydroid shell settings put system volume_ring_speaker 7
|
||
# waydroid shell settings put system volume_system 7
|
||
# waydroid shell settings put system volume_voice 4
|
||
# waydroid shell settings put system volume_voice_speaker 15
|
||
# exit 0;
|
||
#fi
|
||
|
||
echo "Unknown command \"${SCRIPT_LOCATION} $1\", use \"${SCRIPT_LOCATION} help\" for help.";
|
||
exit 1; |