window-manager/scripts/volume-core.sh

48 lines
No EOL
1.6 KiB
Bash
Executable file

#!/bin/sh
SCRIPT_THIS="$(realpath "$0")"
SCRIPT_ROOT="$(dirname "$SCRIPT_THIS")/volume-root.sh"
SCRIPT_ROOT_WD="$(dirname "$SCRIPT_THIS")/waydroid-root.sh"
if [ -z "$1" ]; then
:
elif [ "$1" = "115" ]; then
# „Always control volume on the Linux side” flow commented out and waiting for a better day, because waydroid-root.sh reset-volume is broken (see waydroid-root.sh for details)
#hyprctl activewindow|grep Waydroid >> /dev/null
#if [ $? -eq 0 ]; then
# "$SCRIPT_ROOT_WD" reset-volume
#fi
#hyprpanel vol +5
# Shitty „hand controls to Android when Waydroid is in focus” flow that I wish I could forgo
hyprctl activewindow|grep Waydroid >> /dev/null
if [ $? -eq 0 ]; then
wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%
else
wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
fi
elif [ "$1" = "114" ]; then
# „Always control volume on the Linux side” flow commented out and waiting for a better day, because waydroid-root.sh reset-volume is broken (see waydroid-root.sh for details)
#hyprctl activewindow|grep Waydroid >> /dev/null
#if [ $? -eq 0 ]; then
# "$SCRIPT_ROOT_WD" reset-volume
#fi
#hyprpanel vol -5
# Shitty „hand controls to Android when Waydroid is in focus” flow that I wish I could forgo
hyprctl activewindow|grep Waydroid >> /dev/null
if [ $? -eq 0 ]; then
wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%
else
wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
fi
elif [ "$1" = "--start-daemon" ]; then
while true; do
"$SCRIPT_ROOT"|xargs "$SCRIPT_THIS"
done
elif [ "$1" = "--quit-daemon" ]; then
killall "$(basename "$SCRIPT_THIS")";
else
echo "Unknown flag: $1";
exit 1;
fi