udevbe / greenfield

HTML5 Wayland compositor :seedling:
GNU Affero General Public License v3.0
913 stars 28 forks source link

No working terminal emulator/video acceleration #87

Closed rosensvv closed 2 years ago

rosensvv commented 2 years ago

I noticed that the demo xterm is running via software rendering so I tried installing a wayland native terminal emulator but could not get one working. I tried several different distros and different terminal emulators (alacritty, kitty, konsole, gnome-terminal) and they all failed in different ways. I have the following questions:

  1. Does the project support only software rendering or is it just for apps running in Xwayland?
  2. What would be the best approach to have a remote desktop wayland session? Install an app launcher and start individual apps that way or is a full blown desktop session supported somehow? What would a recommendation be for a distro and terminal emulator that has good native wayland support and would work nicely with greenfield?
Zubnix commented 2 years ago

A good Wayland supported terminal emulator is hard to find. After a lot of trial and error I had some success with this setup:

Dockerfile:

FROM alpine:3.13

RUN apk add --no-cache \
    font-noto \
    font-noto-emoji \
    mesa-egl \
    mesa-gbm \
    mesa-dri-gallium \
    wayland-libs-egl \
    libxkbcommon \
    xkeyboard-config \
    alacritty \
    bash \
    bash-completion \
    util-linux \
    coreutils \
    findutils \
    grep \
    procps \
    vim \
    curl \
    git \
    jq \
    nerd-fonts \
    mc \
    chromium
RUN curl https://raw.githubusercontent.com/riobard/bash-powerline/master/bash-powerline.sh > /etc/profile.d/bash-powerline.sh

RUN adduser -u 1000 -h "/home/$USER" -s "/bin/bash" -D "user"

ENV XDG_CONFIG_HOME="/etc/xdg"
COPY alacritty.yml $XDG_CONFIG_HOME/alacritty/alacritty.yml
RUN chown -R 1000:1000 $XDG_CONFIG_HOME
ENTRYPOINT ["alacritty"]

alacritty.yml:

decorations: full
startup_mode: Windowed
dynamic_title: true
colors:
  # Default Colors
  primary:
    background: '#f1f1f1'
    foreground: '#424242'
  # Normal colors
  normal:
    black:   '#212121'
    red:     '#c30771'
    green:   '#10a778'
    yellow:  '#a89c14'
    blue:    '#008ec4'
    magenta: '#523c79'
    cyan:    '#20a5ba'
    white:   '#e0e0e0'
  # Bright colors
  bright:
    black:   '#212121'
    red:     '#fb007a'
    green:   '#5fd7af'
    yellow:  '#f3e430'
    blue:    '#20bbfc'
    magenta: '#6855de'
    cyan:    '#4fb8cc'
    white:   '#f1f1f1'
shell:
  program: /bin/bash
  args:
    - --login
  1. Does the project support only software rendering or is it just for apps running in Xwayland?

Currently only software (SHM) Wayland apps are supported (as explained in the README.md).

  1. What would be the best approach to have a remote desktop wayland session? Install an app launcher and start individual apps that way or is a full blown desktop session supported somehow? What would a recommendation be for a distro and terminal emulator that has good native wayland support and would work nicely with greenfield?

You probably wouldn't be able to use any of the existing Wayland desktop sessions as they integrate deeply with the rest of the system.

rosensvv commented 2 years ago

This is what I'm getting when I tried this:

thread 'main' panicked at 'Failed to initialize any backend! Wayland status: NoCompositorListening X11 status: XOpenDisplayFailed', /home/buildozer/aports/community/alacritty/src/cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/mod.rs:605:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Zubnix commented 2 years ago

Ugh, yeah it seems it needs the WAYLAND_DISPLAY=wayland-0 environment variable to find the compositor, else it will default to the X11.

In your docker-compose entry it would look like:

  alacritty:
    pid: 'service:compositor-proxy'
    build:
      context: example-apps/alacritty
      dockerfile: Dockerfile
    privileged: false
    volumes:
      - xdg-runtime-dir:/xdg-runtime-dir
    environment:
      WAYLAND_DISPLAY: wayland-0
      XDG_RUNTIME_DIR: /xdg-runtime-dir
    restart: always
Zubnix commented 2 years ago

Did you get this to work?

rosensvv commented 2 years ago

Yes, thank you very much! I left the issue open because it's still missing video acceleration... I haven't had the time yet to create a tidy docker-compose but I still intend to!

Zubnix commented 2 years ago

Yeah video acceleration is currently not supported but is planned. See #92 .