Add rotate-display.sh

This commit is contained in:
2025-12-31 04:26:54 -08:00
parent c46cf90635
commit 172dc926f3

24
rotate-display.sh Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Rotate display 90 degrees left (portrait orientation)
# Wait for display to be ready
sleep 2
# Set DISPLAY if not set
export DISPLAY=:0
# Get the primary display name
DISPLAY_NAME=$(xrandr --query 2>/dev/null | grep " connected" | head -n 1 | cut -d" " -f1)
if [ -n "$DISPLAY_NAME" ]; then
# Rotate left (90 degrees counter-clockwise)
xrandr --output "$DISPLAY_NAME" --rotate left
echo "Display rotated to portrait mode (left)"
else
# Try alternative method for Wayland/other display servers
if command -v gsettings &> /dev/null; then
# For GNOME, try to set rotation through gsettings
gsettings set org.gnome.settings-daemon.plugins.orientation active true 2>/dev/null
fi
echo "Attempted to rotate display"
fi