elros34 / sailfish_linux_chroot

GNU General Public License v3.0
20 stars 4 forks source link

Dead keys work in XFCE4, not in Ubu Chromium installed with ubu-install.sh #6

Open Kabouik opened 4 years ago

Kabouik commented 4 years ago

In Ubu Chromium, dead keys behave as if they were their non-dead alternatives, despite xkb in SFOS clearly mapping them as dead keys.

If Chromium is started from XFCE4, then it works. Same if Ubu Chromium is opened after Ubu XFCE4 has been opened previously, because in that case, Ubu Chromium will run on top of the WM instead of being full screen and isolated into its own SFOS window.

elros34 commented 4 years ago

It's probably because xkb layout is set in .config/autostart/setxkbmap.desktop which is ignored when chromium is started without any desktop environment. As a dirty workaround install pcregrep and add $(sleep 4 && $(pcregrep -o1 'Exec=(.*)' ~/.config/autostart/setxkbmap.desktop) || true) & in scripts/start.sh just before chromium-browser line

Kabouik commented 4 years ago

It didn't work apparently. Did I paste the line in the correct place?

#!/bin/bash
# Do not edit, copied from sailfish_ubu_chroot
set -e
source /usr/share/ubu_chroot/ubu-variables.sh
eval $TRACE_CMD

source ~/.uburc

if [ $(whoami) == "root" ]; then
    print_info "Don't run me as root!"
    exit 1
fi

echo "arguments: $@"

if [ $# -eq 0 ];then
    print_info "supported compositors: kwin, weston, qxcompositor, xfce4, chromium"
    exit 1
fi

start_xwayland() {
    export WAYLAND_DISPLAY=../../display/wayland-ubu-1
    if [ -f /tmp/.X0-lock ]; then
        print_info "Xwayland already running"
    else
        Xwayland -nolisten tcp &
        i=10
        while [ $i -gt 0 ]; do
            if [ -f /tmp/.X0-lock ]; then
                break
            fi
            sleep 1
            ((i--))
        done
    fi
}

if [ "$1" == "kwin" ]; then
    kwin_wayland --width $DISPLAY_WIDTH --height $DISPLAY_HEIGHT --xwayland --wayland-display ../../display/wayland-0 --socket ../../display/wayland-kwin &
elif [ "$1" == "weston" ]; then
    weston
elif [ "$1" == "xfce4" ] || [ "$1" == "xfce" ]; then
    start_xwayland
    startxfce4
elif [ "$1" == "qxcompositor" ]; then
    start_xwayland
elif [ "$1" == "chromium" ] || [ "$1" == "chromium-browser" ]; then #only for hw keyboard devices
    shift
    start_xwayland
    #matchbox-window-manager -use_titlebar no &
    H="$(bc <<< $DISPLAY_HEIGHT/$CHROMIUM_SCALE)"
    W="$(bc <<< $DISPLAY_WIDTH/$CHROMIUM_SCALE)"
    $(sleep 4 && $(pcregrep -o1 'Exec=(.*)' ~/.config/autostart/setxkbmap.desktop) || true) &
    chromium-browser --force-device-scale-factor=$CHROMIUM_SCALE --window-size=$H,$W --window-position=0,0 $@
    #TODO: onboard --layout=Phone, autoshow/hide for hw keyboard less devices
else
    print_info "supported compositors: kwin, weston, qxcompositor"
    $@
fi
elros34 commented 4 years ago

yes, but did you close chroot? Files are synchronized only first time when you are asked about password. Have you tried increasing sleep value? I never used dead keys but my shift,alt,(shift+alt) + key works with this change. You can follow "Debugging" section from Readme too make sure setxkbmap is executed correctly.

Kabouik commented 4 years ago

I did close chroot and check manually that setxkbmap.desktop was updated. Debugging mode shows that:

++ export ON_DEVICE=0
++ ON_DEVICE=0
++ '[' -f /etc/sailfish-release ']'
++ ON_DEVICE=1
+++ logname
++ export HOST_USER=
++ HOST_USER=
++ '[' -z '' ']'
+++ loginctl --no-legend list-users
+++ awk '!/root/ {print $2}'
+++ head -n1
++ HOST_USER=nemo
++ export HOST_HOME_DIR=/home/nemo
++ HOST_HOME_DIR=/home/nemo
+ eval set -x
++ set -x
+ '[' 1 -eq 0 ']'
++ ubu_ssh_pid
++ pgrep -u root -x -f '/usr/sbin/sshd -p 2228'
+ '[' -z '' ']'
++ whoami
+ '[' root '!=' root ']'
+ run_qxcompositor chromium-browser
+ '[' chromium-browser == qxcompositor ']'
+ '[' chromium-browser == xfce4 ']'
+ '[' chromium-browser == chromium ']'
+ '[' chromium-browser == chromium-browser ']'
+ '[' 1 == 1 ']'
++ ubu_qxcompositor_pid
++ pgrep -u nemo -f 'qxcompositor --wayland-socket-name ../../display/wayland-ubu-1'
+ '[' -n '' ']'
+ '[' '!' -f /run/display/wayland-ubu-1.lock ']'
+ sleep 1
+ ubu_host_user_exe 'invoker --type=silica-qt5 qxcompositor --wayland-socket-name ../../display/wayland-ubu-1 -u user -p 2228'
++ whoami
+ '[' root == root ']'
+ LANG=en_US.utf8
+ su nemo -l -c 'invoker --type=silica-qt5 qxcompositor --wayland-socket-name ../../display/wayland-ubu-1 -u user -p 2228'
+ grep -v 'Last login'
+ '[' '!' -f /run/display/wayland-ubu-1.lock ']'
+ '[' chromium-browser == qxcompositor ']'
+ bash ./ubu-chroot.sh sudo --login --user=user /usr/share/ubu_chroot/start.sh chromium-browser
++ export ON_DEVICE=0
++ ON_DEVICE=0
++ '[' -f /etc/sailfish-release ']'
++ ON_DEVICE=1
+++ logname
++ export HOST_USER=
++ HOST_USER=
++ '[' -z '' ']'
+++ loginctl --no-legend list-users
+++ awk '!/root/ {print $2}'
+++ head -n1
++ HOST_USER=nemo
++ export HOST_HOME_DIR=/home/nemo
++ HOST_HOME_DIR=/home/nemo
+ eval set -x
++ set -x
++ ubu_ssh_pid
++ pgrep -u root -x -f '/usr/sbin/sshd -p 2228'
+ '[' -z '' ']'
++ whoami
+ '[' root '!=' root ']'
++ mount
++ grep /.ubuntu
++ wc -l
+ MOUNTS=0
+ '[' 0 -gt 5 ']'
+ '[' 0 -gt 0 ']'
+ ubu_mount_img
+ mount -t ext4 -o loop,noatime ubuntu-19.04-armhf.ext4 /.ubuntu
+ ubu_mount
+ '[' '!' -d /.ubuntu ']'
+ mount --bind /dev /.ubuntu/dev
+ mount --bind -o mode=620 /dev/pts /.ubuntu/dev/pts
+ mount --bind /dev/shm /.ubuntu/dev/shm
+ mount --bind /sys /.ubuntu/sys
+ mount --bind /proc /.ubuntu/proc
+ mount --bind --make-slave --read-only / /.ubuntu/parentroot
+ mount --bind --make-slave /home/nemo /.ubuntu/home/host-user
+ mount --bind /tmp /.ubuntu/tmp
+ '[' 1 == 1 ']'
+ mount --bind /run/display /.ubuntu/run/display
+ mount --bind --make-slave --read-only /system /.ubuntu/parentroot/system
+ '[' 1 == 1 ']'
+ '[' -d /.ubuntu/run/user/100000 ']'
+ mkdir -p /.ubuntu/run/user/100000/pulse
+ mount --bind /run/user/100000/pulse /.ubuntu/run/user/100000/pulse
+ mount --bind /var/lib/dbus /.ubuntu/var/lib/dbus
+ '[' -d /.ubuntu/home/user/.config/pulse ']'
+ mount -o bind,ro /home/nemo/.config/pulse /.ubuntu/home/user/.config/pulse
++ ls /run/media/nemo
ls: cannot access /run/media/nemo: No such file or directory
+ _ubu_chroot sudo --login --user=user /usr/share/ubu_chroot/start.sh chromium-browser
+ '[' 5 -gt 0 ']'
+ ubu_chroot /usr/share/ubu_chroot/chroot.sh sudo --login --user=user /usr/share/ubu_chroot/start.sh chromium-browser
++ readlink -f /etc/resolv.conf
+ rsync -a /run/connman/resolv.conf /.ubuntu/etc/
+ rsync -a scripts/chroot.sh scripts/create.sh scripts/install.sh scripts/start.sh /.ubuntu/usr/share/ubu_chroot/
+ rsync -a ubu-variables.sh /.ubuntu/usr/share/ubu_chroot/
+ chmod a+x /.ubuntu/usr/share/ubu_chroot/chroot.sh /.ubuntu/usr/share/ubu_chroot/create.sh /.ubuntu/usr/share/ubu_chroot/inst
all.sh /.ubuntu/usr/share/ubu_chroot/start.sh /.ubuntu/usr/share/ubu_chroot/ubu-variables.sh
+ rsync -a scripts/dotuburc /.ubuntu/home/user/.uburc
++ hostname
+ HOSTNAME=Sailfish
+ grep -q Sailfish /.ubuntu/etc/hosts
+ '[' '!' -f /home/nemo/.ssh/id_rsa.pub ']'
++ cat /home/nemo/.ssh/id_rsa.pub
+ grep -q 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDHu/KlVygekntKyOoPh/+OJmgvqIwZqXUhzuApIQnALy3F7ff97SLWqvVxH+Kdbzv6xiIplf82xdJ
xyFXmoJ97Vpe/B293Dtj6Upo6yIFhHzg9L+6ehWbP5pFmg4XIa/TrOcPKtg1W52eF6J6JoHMZPRqu0mhJmXSnxvy9PEBDementdua9x2JnPAnIxD7oTd2KQwLFo53q
llbZYDt83r6RyJqO+1/AtOhXFYlFZqZyzB19i9vMVL3lhoEcbCHkiJmQjDVCL1Ho8MtJ2BypG5nbwh2AGQIIIkvF6zmku2lvXIxQZf7DnY61znqb68m5DWLBjnU7kM
2ZYmgllADti8KF8P+9NmjBC9f+zF7kZJ05Sf9dmJtS+E5s80opVwoc8PHKauryF9xkE6gGPZ8obdFMPJ9XOrel8UN4GLSIa+YhQDw4mNnWH9x3fyfyV7B6aoTg/wZe
z/LawZ6Znsuu4Tc9HuDlSi88fClbWxFV9cuYua/JRdTrBDvf2S8cP0GmD8= nemo@Sailfish' /.ubuntu/home/user/.ssh/authorized_keys
++ stat -c '%a %G:%U' /.ubuntu
+ '[' '755 root:root' '!=' '755 root:root' ']'
+ '[' 1 == 1 ']'
+ '[' '!' -f .screen_dimensions_set ']'
+ '[' 1 == 1 ']'
+ '[' 1 == 1 ']'
+ '[' -d /.ubuntu/usr/share/X11/xkb ']'
+ '[' '!' -f .xkeyboard_synced ']'
+ print_info 'chrooting /.ubuntu'
+ echo -e '\n\e[93m=== chrooting /.ubuntu ===\n\e[0m'

=== chrooting /.ubuntu ===

+ chroot /.ubuntu /usr/bin/env -i HOME=/root TERM=xterm 'PS1=[\u@ubu-chroot: \w]# ' PATH=/usr/local/sbin:/usr/local/bin:/usr/s
bin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games /bin/bash --login /usr/share/ubu_chroot/chroot.sh sudo --login --user=user
/usr/share/ubu_chroot/start.sh chromium-browser
+ '[' '!' -f /run/sshd.pid ']'
+ /usr/sbin/sshd -p 2228
+ '[' -d /parentroot/usr/libexec/droid-hybris/system/ ']'
++ mount
++ grep 'unionfs on /system'
+ '[' -z '' ']'
+ unionfs -o allow_other,nonempty /parentroot/usr/libexec/droid-hybris/system/:/parentroot/system/ /system
+ sudo --login --user=user /usr/share/ubu_chroot/start.sh chromium-browser
+ source /home/user/.uburc
++ source /usr/share/ubu_chroot/ubu-variables.sh
+++ IMG_SIZE=3900M
+++ TARGET_URL=http://cdimage.ubuntu.com/ubuntu-base/releases/19.04/release/ubuntu-base-19.04-base-armhf.tar.gz
+++ TARGET_URL2=https://github.com/elros34/sailfish_ubu_chroot/releases/download/v0.2/ubuntu-base-19.04-base-kernel-3.0.0-armh
f.tar.gz
+++ CHROOT_IMG=ubuntu-19.04-armhf.ext4
+++ export 'TRACE_CMD=set -x'
+++ TRACE_CMD='set -x'
+++ export USER_NAME=user
+++ USER_NAME=user
+++ export CHROOT_DIR=/.ubuntu
+++ CHROOT_DIR=/.ubuntu
+++ export ENABLE_AUDIO=1
+++ ENABLE_AUDIO=1
+++ export SYNC_XKEYBOARD=1
+++ SYNC_XKEYBOARD=1
+++ dbus-launch
++ export DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-cf5vXyvL8y,guid=5d446a68a47acb23e04c43e05e016c46 DBUS_SESSION_BUS_P
ID=11700
++ DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-cf5vXyvL8y,guid=5d446a68a47acb23e04c43e05e016c46
++ DBUS_SESSION_BUS_PID=11700
++ trap 'source "$HOME/.bash_logout"' EXIT
++ export TERM=xterm-256color
++ TERM=xterm-256color
++ export XDG_RUNTIME_DIR=/run/user/100000
++ XDG_RUNTIME_DIR=/run/user/100000
++ export WAYLAND_DISPLAY=../../display/wayland-0
++ WAYLAND_DISPLAY=../../display/wayland-0
++ export EGL_PLATFORM=wayland
++ EGL_PLATFORM=wayland
++ export EGL_DRIVER=egl_gallium
++ EGL_DRIVER=egl_gallium
++ export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
++ QT_WAYLAND_DISABLE_WINDOWDECORATION=1
++ export QT_QPA_PLATFORM=wayland
++ QT_QPA_PLATFORM=wayland
++ export QT_WAYLAND_FORCE_DPI=96
++ QT_WAYLAND_FORCE_DPI=96
++ export CHROMIUM_SCALE=1.5
++ CHROMIUM_SCALE=1.5
++ export DISPLAY=:0
++ DISPLAY=:0
+++ head -n1
+++ grep -Eo '[0-9]+x[0-9]+'
+++ cat /sys/class/graphics/fb0/modes
++ DISPLAY_RES=1080x2160
++ '[' -z 1080x2160 ']'
++ export DISPLAY_WIDTH=1080
++ DISPLAY_WIDTH=1080
++ export DISPLAY_HEIGHT=2160
++ DISPLAY_HEIGHT=2160
++ export 'PS1=[\u@ubu-chroot: \w]# '
++ PS1='[\u@ubu-chroot: \w]# '
++ whoami
+ '[' user == root ']'
+ echo 'arguments: chromium-browser'
arguments: chromium-browser
+ '[' 1 -eq 0 ']'
+ '[' chromium-browser == kwin ']'
+ '[' chromium-browser == weston ']'
+ '[' chromium-browser == xfce4 ']'
+ '[' chromium-browser == xfce ']'
+ '[' chromium-browser == qxcompositor ']'
+ '[' chromium-browser == chromium ']'
+ '[' chromium-browser == chromium-browser ']'
+ shift
+ start_xwayland
+ export WAYLAND_DISPLAY=../../display/wayland-ubu-1
+ WAYLAND_DISPLAY=../../display/wayland-ubu-1
+ '[' -f /tmp/.X0-lock ']'
+ i=10
+ '[' 10 -gt 0 ']'
+ '[' -f /tmp/.X0-lock ']'
+ sleep 1
+ Xwayland -nolisten tcp
glamor: 'wl_drm' not supported
Missing Wayland requirements for glamor GBM backend
Failed to initialize glamor, falling back to sw
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported high keycode 361 for name <I361> ignored
>                   X11 cannot support keycodes above 255.
>                   This warning only shows for the first high keycode.
Errors from xkbcomp are not fatal to the X server
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Error:            Illegal keycode 774 (must be in the range 8-255 inclusive)
>                   Value of "maximum" not changed
> Warning:          Unsupported high keycode 361 for name <I361> ignored
>                   X11 cannot support keycodes above 255.
>                   This warning only shows for the first high keycode.
Errors from xkbcomp are not fatal to the X server
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported high keycode 361 for name <I361> ignored
>                   X11 cannot support keycodes above 255.
>                   This warning only shows for the first high keycode.
Errors from xkbcomp are not fatal to the X server
+ (( i-- ))
+ '[' 9 -gt 0 ']'
+ '[' -f /tmp/.X0-lock ']'
+ break
++ bc
+ H=1440
++ bc
+ W=720
+ chromium-browser --force-device-scale-factor=1.5 --window-size=1440,720 --window-position=0,0
++ sleep 4
[11727:11765:1224/023919.872570:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/sys
tem_bus_socket: No such file or directory
[11776:11776:1224/023920.080534:ERROR:sandbox_linux.cc(372)] InitializeSandbox() called with multiple threads in process gpu-p
rocess.
[11727:11875:1224/023920.235347:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/sys
tem_bus_socket: No such file or directory
[11727:11875:1224/023920.235465:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/sys
tem_bus_socket: No such file or directory
[11727:11875:1224/023920.235589:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/sys
tem_bus_socket: No such file or directory
[11727:11875:1224/023920.235663:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/sys
tem_bus_socket: No such file or directory
[11727:11875:1224/023920.235737:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/sys
tem_bus_socket: No such file or directory
[11810:10:1224/023920.249537:ERROR:command_buffer_proxy_impl.cc(124)] ContextResult::kTransientFailure: Failed to send GpuChan
nelMsg_CreateCommandBuffer.
+++ pcregrep -o1 'Exec=(.*)' /home/user/.config/autostart/setxkbmap.desktop
++ setxkbmap -layout ''\''us'\''' -rules evdev -model ''\''fxtecpro1'\''' -option
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported high keycode 361 for name <I361> ignored
>                   X11 cannot support keycodes above 255.
>                   This warning only shows for the first high keycode.
Errors from xkbcomp are not fatal to the X server
[11970:73:1224/023923.961514:ERROR:child_process_sandbox_support_impl_linux.cc(79)] FontService unique font name matching requ
est did not receive a response.
[11970:73:1224/023923.967310:ERROR:child_process_sandbox_support_impl_linux.cc(79)] FontService unique font name matching requ
est did not receive a response.
[11970:73:1224/023923.970833:ERROR:child_process_sandbox_support_impl_linux.cc(79)] FontService unique font name matching requ
est did not receive a response.
[11970:73:1224/023923.974020:ERROR:child_process_sandbox_support_impl_linux.cc(79)] FontService unique font name matching requ
est did not receive a response.

I don't think keycode 361 is the issue because SFOS hs the same xkb issue with keycodes > 255, and this key is not used in my layout anyway.

For reference, my layout is here. As mentioned in #5, everything but level 3 and 4 works in Ubu desktop (including dead keys), and everything but dead keys work in SFOS (I guess there is a limitation in SFOS for dead keys). In Ubu Chromium, I have the same ralt issue as in xfce4, but deadkeys behave as non-dead keys (meaning the characters like ' appear in just one key press, while it should be two key presses, like ' then Space to display ', or ' then e to display é).

elros34 commented 4 years ago

I replaced key <TLDE> { [apostrophe, quotedbl, grave, U007E ] }; with key <TLDE> { [ dead_acute, quotedbl, grave, U007E ] }; in my layout inside ubuntu (dev branch). After that when I press ' + space I get ' and ' + e I get é, both in xfce and chromium without window manager so unlikely it's browser issue.