38 lines
1.1 KiB
Bash
Executable File
38 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# -----------------------------------------------------------------------------#
|
|
# Display Scale Toggling Script for GNOME RDP Session. Writen to work with the #
|
|
# Custom Command Toggles GNOME extension. Note: use the following command to #
|
|
# get the current scale as the check check command of the exteion: #
|
|
# $ gdctl show | grep Scale:\.* #
|
|
# -----------------------------------------------------------------------------#
|
|
|
|
# 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 "Error: 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
|
|
SCALE=1.5
|
|
else
|
|
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"
|