VirtualBox

Changeset 101943 in vbox


Ignore:
Timestamp:
Nov 7, 2023 2:00:47 PM (15 months ago)
Author:
vboxsync
Message:

Additions: X11/Wayland: Add --check switch to vboxwl which should tell startup script either X11 or Wayland version of VBoxClient should be started, bugref:10194.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/vboxwl.cpp

    r101887 r101943  
    634634    RTPrintf("  %-20s Copy content from clipboard\n", VBOXWL_ARG_CLIP_GH_COPY);
    635635
     636    RTPrintf("  --check              Check if active Wayland session is running\n");
    636637    RTPrintf("  --verbose            Increase verbosity level\n");
    637638    RTPrintf("  --version            Print version number and exit\n");
     
    643644
    644645/**
     646 * Check if active Wayland session is running.
     647 *
     648 * This check is used in order to detect whether X11 or Wayland
     649 * version of VBoxClient should be started when user logs-in.
     650 * It will print out either WL or X11 and exit. Startup script(s)
     651 * should rely on this output.
     652 */
     653static void vboxwl_check(void)
     654{
     655    VBGHDISPLAYSERVERTYPE enmType = VBGHDisplayServerTypeDetect();
     656    bool fWayland = false;
     657
     658    /* In pure Wayland environment X11 version of VBoxClient will not
     659     * work, so fallback on Wayland version. */
     660    if (enmType == VBGHDISPLAYSERVERTYPE_PURE_WAYLAND)
     661        fWayland = true;
     662    else if (enmType == VBGHDISPLAYSERVERTYPE_XWAYLAND)
     663    {
     664        /* In case of XWayland, X11 version of VBoxClient still can
     665         * work, however with some DEs, such as Plasma on Wayland,
     666         * this will no longer work. Detect such DEs here. */
     667
     668        /* Try to detect Plasma. */
     669        const char *pcszDesktopSession = RTEnvGet(VBGH_ENV_DESKTOP_SESSION);
     670        if (RT_VALID_PTR(pcszDesktopSession) && RTStrIStr(pcszDesktopSession, "plasmawayland"))
     671            fWayland = true;
     672    }
     673
     674    RTPrintf("%s\n", fWayland ? "WL" : "X11");
     675    exit (0);
     676}
     677
     678/**
    645679 * Print version and exit.
    646680 */
     
    666700        { VBOXWL_ARG_CLIP_GH_COPY,      'c', RTGETOPT_REQ_NOTHING },
    667701        { VBOXWL_ARG_SESSION_ID,        's', RTGETOPT_REQ_UINT32  },
     702        { "--check",                    'C', RTGETOPT_REQ_NOTHING },
    668703        { "--help",                     'h', RTGETOPT_REQ_NOTHING },
    669704        { "--version",                  'V', RTGETOPT_REQ_NOTHING },
     
    710745                }
    711746
     747                case 'C':
     748                {
     749                    vboxwl_check();
     750                    break;
     751                }
     752
    712753                case 'h':
    713754                {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette