Results 1 to 2 of 2

Thread: How can I programmatically find a value of current DISPLAY for a session?

  1. #1
    Join Date
    Jun 2021
    Beans
    11

    How can I programmatically find a value of current DISPLAY for a session?

    I'm looking at https://github.com/canonical/ubuntu-...ity-server#L22

    I see:
    Code:
    export DISPLAY=:0
    Is there a way to do the same, but programmaticaly find out in a shell script how many there are displays and what are the numbers. For example, it is not ":0" just now, it's ":10.0". Hard-code do not fit.

    How do I know what are available current values for DISPLAY for a session?

    thx!

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How can I programmatically find a value of current DISPLAY for a session?

    Code:
    echo $DISPLAY
    The DISPLAY usually is set automatically these days and if you use ssh -X it will be for you. If you are doing a remote desktop, then it is up to you to understand which values are correct and should be used. Check the remote desktop documentation for how they handle it .... or better .... use a better remote desktop solution which just handles it better. The NX-based solutions like x2go do this AND they are more secure AND they are faster.

    It is just and environment variable and can be accessed or modified however you like. Of course, if you modify it incorrectly, no GUI will work.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •