Pengwin icon indicating copy to clipboard operation
Pengwin copied to clipboard

No need to run the desktop with Xrdb - Much better perf with Xephyr!

Open chuckmarcotte opened this issue 1 year ago • 5 comments
trafficstars

Install Xephyr and Xfce4 first.

$ cat ~/launch_desktop.xfce4 

#!/bin/bash
echo "Current DISPLAY=$DISPLAY"
echo "Finding a free DISPLAY number"
for i in $(seq 1 20);
do
    DISPLAY=":$i" xset q >/dev/null 2>/dev/null ; RET=$?
    if [ "$RET" -ne "0" ] ; then
        export NEW_DISPLAY=":$i"
        break;
    fi
done
echo "Starting Xephyr and a new desktop on DISPLAY=$NEW_DISPLAY"
export XEPHYR_ID 
export DISPLAY
{
    Xephyr "$NEW_DISPLAY" -title "XFCE4 Desktop for $USER" -once -screen 2560x1080 -resizeable >/dev/null 2>/dev/null & XEPHYR_ID="$!" 
    DISPLAY="$NEW_DISPLAY" startxfce4 >/tmp/launch_desktop_xfce4.log 2>&1
    kill $XEPHYR_ID 2>/dev/null
} &

Chuck Marcotte

http://www.linkedin.com/in/charles-marcotte

chuckmarcotte avatar Nov 22 '24 17:11 chuckmarcotte

Better:

#!/bin/bash
echo "Current DISPLAY=$DISPLAY"
echo "Finding a free DISPLAY number"
for i in $(seq 1 20);
do
    DISPLAY=":$i" xset q >/dev/null 2>/dev/null ; RET=$?
    if [ "$RET" -ne "0" ] ; then
        export NEW_DISPLAY=":$i"
        break;
    fi
done
echo "Starting Xephyr and a new desktop on DISPLAY=$NEW_DISPLAY"
export XEPHYR_ID 
export DISPLAY

nohup Xephyr "$NEW_DISPLAY" -title "XFCE4 Desktop for $USER" -once -screen 2560x1080 -resizeable >/dev/null 2>/dev/null & XEPHYR_ID="$!" &
sleep 2
DISPLAY="$NEW_DISPLAY" nohup startxfce4 >/tmp/launch_desktop_xfce4.log 2>&1 &
disown -a

chuckmarcotte avatar Nov 22 '24 18:11 chuckmarcotte

  • Added a fg option - needed by a window shortcut?
  • disown added
  • added more cleanup arguments to Xephyr server
$ cat ~/launch_desktop.xfce4
#!/bin/bash
echo "Current DISPLAY=$DISPLAY"
echo "Finding a free DISPLAY number"
for i in $(seq 1 20);
do
    DISPLAY=":$i" xset q >/dev/null 2>/dev/null ; RET=$?
    if [ "$RET" -ne "0" ] ; then
        export NEW_DISPLAY=":$i"
        break;
    fi
done
echo "Starting Xephyr and a new desktop on DISPLAY=$NEW_DISPLAY"
export XEPHYR_ID 
export DISPLAY
if [ "$1" == "-fg" ] ; then
    Xephyr "$NEW_DISPLAY" -title "XFCE4 Desktop for $USER" -once -reset -terminate -screen 2560x1080 -resizeable >/dev/null 2>/dev/null & XEPHYR_ID="$!" 
    DISPLAY="$NEW_DISPLAY" startxfce4 >/tmp/launch_desktop_xfce4.log 2>&1
    kill $XEPHYR_ID 2>/dev/null
else
    {
        Xephyr "$NEW_DISPLAY" -title "XFCE4 Desktop for $USER" -once -reset -terminate -screen 2560x1080 -resizeable >/dev/null 2>/dev/null & XEPHYR_ID="$!" 
        DISPLAY="$NEW_DISPLAY" startxfce4 >/tmp/launch_desktop_xfce4.log 2>&1
        kill $XEPHYR_ID 2>/dev/null
    } &
    disown -a
fi

chuckmarcotte avatar Nov 24 '24 23:11 chuckmarcotte

Hello @chuckmarcotte,

Very good idea, I have also seen another one with XWayland, both take advantage of WSLg.

I need take time to test them an include them in the install_desktop script

Thanks

crramirez avatar Nov 25 '24 06:11 crramirez

i keep tweaking: #!/bin/bashecho "Current DISPLAY=$DISPLAY"echo "Finding a free DISPLAY number"for i in $(seq 1 20);do    DISPLAY=":$i" xset q >/dev/null 2>/dev/null ; RET=$?    if [ "$RET" -ne "0" ] ; then        export NEW_DISPLAY=":$i"        break;    fidoneecho "Starting Xephyr and a new desktop on DISPLAY=$NEW_DISPLAY"export XEPHYR_ID export DISPLAYif [ "$1" == "-fg" ] ; then    Xephyr "$NEW_DISPLAY" -title "XFCE4 Desktop for $USER" -once -reset -terminate -screen 2560x1080 -resizeable </dev/null >/dev/null 2>/dev/null & XEPHYR_ID="$!"     DISPLAY="$NEW_DISPLAY" startxfce4 >/tmp/launch_desktop_xfce4.log 2>&1    kill $XEPHYR_ID 2>/dev/nullelse    {        Xephyr "$NEW_DISPLAY" -title "XFCE4 Desktop for $USER" -once -reset -terminate -screen 2560x1080 -resizeable </dev/null >/dev/null 2>/dev/null & XEPHYR_ID="$!"         DISPLAY="$NEW_DISPLAY" startxfce4 >/tmp/launch_desktop_xfce4.log 2>&1        kill $XEPHYR_ID 2>/dev/null    } &    disown -afi

Windows shortcut:  C:\Windows\System32\wscript.exe C:\Users\chuck\wslu\runHidden.vbs C:\Users\chuck\AppData\Local\Microsoft\WindowsApps\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\pengwin.exe run  /usr/share/wslu/wslusc-helper.sh "/home/chuck/launch_desktop.xfce4 -fg"

On Monday, November 25, 2024 at 12:55:16 AM CST, Carlos Rafael Ramirez ***@***.***> wrote:  

Hello @chuckmarcotte,

Very good idea, I have also seen another one with XWayland, both take advantage of WSLg.

I need take time to test them an include them in the install_desktop script

Thanks

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

chuckmarcotte avatar Nov 25 '24 18:11 chuckmarcotte

I don't know why I though you were in the Fedora GitHub, not in Pengwin. This can be added to the Pengwin setup.

crramirez avatar Nov 25 '24 18:11 crramirez