#!/bin/sh # -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*- # # Copyright (C) 2011, 2013, 2016 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation, version 3 of the License. # # See http://www.gnu.org/copyleft/gpl.html the full text of the license. # This wrapper merely ensures that init and friends live only as long as this # script does. Otherwise, it's very easy for some processes to not notice that # the session died. We could try to do this in-process, but we want to do this # cleanup even if the greeter aborts. # Ensure the shell always gets unthrottled touch events, so that applications # who want full speed low-latency input can get it (LP: #1497105) and so that # apps can use QML touch compression safely (the QML touch compression # algorithm does not support nesting well - LP: #1486341, LP: #1556763 - so # must be fed by the raw input event stream from Unity8). export QML_NO_TOUCH_COMPRESSION=1 trap cleanup TERM EXIT cleanup() { trap - TERM EXIT if [ -n "$CMD_PID" ]; then kill "$CMD_PID" fi exit 0 } set_greeter_var() { export "$1=$2" dbus-update-activation-environment --systemd "$1=$2" } echo "DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}" >"$XDG_RUNTIME_DIR/dbus-session" if [ -x "$(command -v device-info)" ]; then set_greeter_var GRID_UNIT_PX $(device-info get GridUnit) set_greeter_var QTWEBKIT_DPR $(device-info get WebkitDpr) set_greeter_var NATIVE_ORIENTATION $(device-info get PrimaryOrientation) set_greeter_var QT_WAYLAND_FORCE_DPI $((12 * ${GRID_UNIT_PX})) fi # Hack for virtual machines that fails to probe modeset if ([ -x "$(command -v hostnamectl)" ] && [ "$(hostnamectl status | grep 'Chassis: vm')" ]) \ || grep -wq hypervisor /proc/cpuinfo; then set_greeter_var MIR_MESA_KMS_DISABLE_MODESET_PROBE 1 fi set_greeter_var QT_IM_MODULE maliit set_greeter_var QT_QPA_PLATFORM wayland set_greeter_var MALIIT_FORCE_DBUS_CONNECTION 1 set_greeter_var UITK_ICON_THEME suru set_greeter_var QT_WAYLAND_DISABLE_WINDOWDECORATION 1 set_greeter_var QT_ACCESSIBILITY 1 set_greeter_var QT_AUTO_SCREEN_SCALE_FACTOR 0 set_greeter_var GTK_CSD 0 # We disable ofono using pulse. It causes problems with racing with the user's # pulse. We need to come up with a better long-term fix for this, because we # eventually need the greeter to play ringtones for users that aren't logged in. set_greeter_var PA_DISABLED 1 # Claim the user wldisplay set_greeter_var WAYLAND_DISPLAY=wayland-0 # And finally actually start the greeter exec ${LOMIRI_BINARY:-lomiri} --mode=greeter "$@" & CMD_PID=$! sleep 1 # Advertise as a lomiri session, so that lomiri-indicator-network will start # and also all other indicators will recognize being run in Lomiri set_greeter_var XDG_CURRENT_DESKTOP Lomiri set_greeter_var DESKTOP_SESSION lomiri systemctl --user start ayatana-indicators.target sleep 2 systemctl --user start lomiri-keyboard.service wait $CMD_PID CMD_PID= systemctl --user stop lomiri-keyboard.service systemctl --user stop ayatana-indicators.target