No internet connection
  1. Home
  2. General

Preview on vertical monitor

By Josef @yesyes
    2023-03-28 12:27:46.231Z

    Is there some setting for swapping grabbed video to vertical? Right now video is sideway and mouse is horizontal so its kinda tricky but still works

    • 2 replies
    1. @fft2023-03-29 05:03:51.957Z

      Hi,
      I personally never had this, so cannot help directly. But I googled for "rotate hdmi 90 degree" and got https://www.amazon.com/Rotating-Support-Vertical-Portrait-Display/dp/B09KN8Q4RT which might be put in between TinyPilot and your server, or you google for "raspberry rotate screen 90 degree" and get something like https://pimylifeup.com/raspberry-pi-rotate-screen/ So I personally see a chance to rotate the HDMI output of the TinyPilot but it is definitely not out of the box, but I see a chance for it.
      sorry for not giving a real solution, but hopefully, I could give an idea.

      thanks
      Juergen

      1. In reply toyesyes:
        David @david2023-03-29 12:55:58.591Z2023-03-29 14:07:17.983Z

        Hi @yesyes, thanks for your question!

        Unfortunately, there isn't a setting for switching between landscape and portrait modes. However, there is a workaround using CSS styles that you can use if you're only using a portrait display (and you're comfortable with editing some code).

        I've adapted these instructions from a user on the TinyPilot GitHub repository.

        First, ssh into your TinyPilot.

        Copy index.html and create a backup - just in case.

        cp /opt/tinypilot/app/templates/index.html /opt/tinypilot/app/templates/index.html.bak
        

        Now run the following command to add the CSS style to the element:

        OLD_HTML='<remote-screen
                  id="remote-screen"
                  milliseconds-between-mouse-events="600"
                ></remote-screen>'
        
        NEW_HTML='<remote-screen
                  id="remote-screen"
                  milliseconds-between-mouse-events="600"
                  style="height: 65vh;margin-top: 10vh;margin-bottom: 20vh;transform: rotate(0.25turn);"
                ></remote-screen>'
        
        # Use awk to perform the substitution
        awk -v RS="" -v ORS="\n" -v old="$OLD_HTML" -v new="$NEW_HTML" \
          '{gsub(old, new)} 1' /opt/tinypilot/app/templates/index.html > temp.html && \
          sudo mv -force temp.html /opt/tinypilot/app/templates/index.html
        

        You may need to alter the styles to match your orientation (particularly rotate in NEW_HTML if the portrait orientation needs flipping).

        If you need to revert back to portrait mode, ssh into your TinyPilot and then run the following command:

        sudo cp /opt/tinypilot/app/templates/index.html.bak /opt/tinypilot/app/templates/index.html
        

        I should let you know that TinyPilot software updates will overwrite these changes - meaning you'll have to run these commands again if you update.

        Hope that helps! Please let me know if you have any questions.