Updated toggle-gdctl-scale script.
This commit is contained in:
@@ -1,17 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# -----------------------------------------------------------------------------#
|
||||||
|
# Display Scale Toggling Script for GNOME RDP Session.
|
||||||
|
# -----------------------------------------------------------------------------#
|
||||||
|
|
||||||
# Check if gnome-shell is running as `gdctl` is GNOME only
|
# Only for GNOME shell.
|
||||||
if ! pgrep -x "gnome-shell" > /dev/null; then
|
if ! pgrep -x "gnome-shell" > /dev/null; then
|
||||||
echo "Error: gnome-shell is not running."
|
echo "Error: gnome-shell is not running."
|
||||||
return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set scale explicitly to argument value.
|
# 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
|
if [ $# -eq 1 ]; then
|
||||||
# gdctl set -LM Meta-0 --primary --scale $1
|
|
||||||
SCALE=$1
|
SCALE=$1
|
||||||
else
|
else
|
||||||
# If no argument is given, toggle between 1.0 and 1.5 scales.
|
# Toggle if not specified.
|
||||||
if gdctl show | grep -q "Scale: 1.0"; then
|
if gdctl show | grep -q "Scale: 1.0"; then
|
||||||
#gdctl set -LM Meta-0 --primary --scale 1.5
|
#gdctl set -LM Meta-0 --primary --scale 1.5
|
||||||
SCALE=1.5
|
SCALE=1.5
|
||||||
@@ -21,6 +29,8 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Apply and output.
|
# Apply
|
||||||
gdctl set -LM Meta-0 --primary --scale $SCALE
|
gdctl set -LM Meta-0 --primary --scale $SCALE
|
||||||
|
|
||||||
|
# Print output for the check-command.
|
||||||
printf "Setting display scale to: $SCALE\n"
|
printf "Setting display scale to: $SCALE\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user