Add automatic page scaling to fit viewport without scrolling

This commit is contained in:
nearxos
2026-01-09 10:41:57 +02:00
parent cc3adf7e4e
commit 61cf81faa5
2 changed files with 284 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ sleep 5
# Wait for Chromium window to appear and then force fullscreen
sleep 3
# Try to find Chromium window and force it to fullscreen
WINDOW_ID=""
for i in {1..10}; do
WINDOW_ID=$(wmctrl -l 2>/dev/null | grep -i chromium | head -1 | awk '{print $1}')
if [ -n "$WINDOW_ID" ]; then
@@ -39,6 +40,23 @@ for i in {1..10}; do
sleep 0.5
done
# Wait for page to load, then auto-scale to fit
sleep 5
if [ -n "$WINDOW_ID" ] && command -v xdotool >/dev/null 2>&1; then
# Activate Chromium window
xdotool windowactivate $WINDOW_ID 2>/dev/null
sleep 1
# Reset zoom first (Ctrl+0)
xdotool key --window $WINDOW_ID ctrl+0 2>/dev/null
sleep 1
# Zoom out to fit (Ctrl+- multiple times if needed)
# Adjust the number of zoom-out commands based on your page size
for i in {1..3}; do
xdotool key --window $WINDOW_ID ctrl+minus 2>/dev/null
sleep 0.5
done
fi
# Keep script running
wait