25 lines
773 B
Bash
25 lines
773 B
Bash
#!/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
|