File: lomiri-greeter-wrapper

package info (click to toggle)
lomiri 0.5.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 24,088 kB
  • sloc: cpp: 39,498; python: 2,559; javascript: 1,426; ansic: 1,012; sh: 289; xml: 252; makefile: 69
file content (95 lines) | stat: -rw-r--r-- 3,234 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/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
    set_greeter_var LOMIRI_RUNNING_IN_VM 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 lomiri-indicators.target

sleep 2

systemctl --user start lomiri-keyboard.service

wait $CMD_PID
CMD_PID=

systemctl --user stop lomiri-keyboard.service
systemctl --user stop lomiri-indicators.target