Files
scripts/toggle-gdctl-scale

37 lines
945 B
Bash
Executable File

#!/bin/bash
# -----------------------------------------------------------------------------#
# Display Scale Toggling Script for GNOME RDP Session.
# -----------------------------------------------------------------------------#
# Only for GNOME shell.
if ! pgrep -x "gnome-shell" > /dev/null; then
echo "Error: gnome-shell is not running."
exit 1
fi
# Only for remote session.
if ! gdctl show | grep -q "Meta-0"; then
echo "Could not find monitor Meta-0, seems not a remote session."
exit 2
fi
# Explicit scale.
if [ $# -eq 1 ]; then
SCALE=$1
else
# Toggle if not specified.
if gdctl show | grep -q "Scale: 1.0"; then
#gdctl set -LM Meta-0 --primary --scale 1.5
SCALE=1.5
else
#gdctl set -LM Meta-0 --primary --scale 1
SCALE=1
fi
fi
# Apply
gdctl set -LM Meta-0 --primary --scale $SCALE
# Print output for the check-command.
printf "Setting display scale to: $SCALE\n"