on xenial help sign in
Add scale settings and use wayland for clients
commit2fa0f39c2ba9821e0af40479825c148c26d35cb4 authorMarius Gripsgard <marius@ubports.com> dateWed 11 Apr 2018, 02:46 (9 years ago) parent04587fc
1 file changed+37−2
data/unity8-session+37−2
data/unity8-session+37−2
@@ -1,4 +1,4 @@
1−#!/bin/sh
1+#!/bin/bash
22# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 2 -*-
33
44# Ensure the shell always gets unthrottled touch events, so that applications
@@ -28,12 +28,46 @@ else
2828 MODE=full-shell
2929fi
3030
31−dbus-update-activation-environment --systemd MIR_SOCKET=$MIR_SERVER_FILE
31+# Add options for settings
32+if [ -f ~/.unity8/configs.conf ]; then
33+ source ~/.unity8/configs.conf
34+fi
35+
36+# Scale settings
37+isfloat='^[0-9]+([.][0-9]+)?$'
38+isint='^[0-9]+$'
39+if [[ $SCALE =~ $isfloat ]]; then
40+ if ! [ $SCALE == "0" ]; then
41+ export GRID_UNIT_PX=$(LC_ALL=C printf %.0f $((8 * ${SCALE})))
42+ export QT_WAYLAND_FORCE_DPI=$(LC_ALL=C printf %.0f $((96 * ${SCALE})))
43+ fi
44+fi
45+
46+if [[ $GRID_UNIT_PX =~ $isint ]]; then
47+ dbus-update-activation-environment --systemd GRID_UNIT_PX=${GRID_UNIT_PX}
48+fi
49+
50+if [[ $QT_WAYLAND_FORCE_DPI =~ $isint ]]; then
51+ dbus-update-activation-environment --systemd QT_WAYLAND_FORCE_DPI=${QT_WAYLAND_FORCE_DPI}
52+fi
3253
3354# Tell unity-mir to raise SIGSTOP after we start, which we use to tell
3455# systemd when we are done starting up.
3556export UNITY_MIR_EMITS_SIGSTOP=1
3657
58+# Set some envs
59+dbus-update-activation-environment --systemd QT_QPA_PLATFORM=wayland
60+dbus-update-activation-environment --systemd GDK_BACKEND=wayland
61+dbus-update-activation-environment --systemd SDL_VIDEODRIVER=wayland
62+dbus-update-activation-environment --systemd UNITY8_SHELL_QT_QPA_PLATFORM=mirserver
63+dbus-update-activation-environment --systemd QT_WAYLAND_DISABLE_WINDOWDECORATION=1
64+dbus-update-activation-environment --systemd QT_ACCESSIBILITY=1
65+dbus-update-activation-environment --systemd QT_AUTO_SCREEN_SCALE_FACTOR=0
66+dbus-update-activation-environment --systemd GTK_CSD=0
67+
68+# We need to be sure we dont use mir-on-mir
69+unset MIR_SERVER_HOST_SOCKET
70+
3771${BINARY:-unity8} --mode=$MODE "$@" &
3872child=$!
3973
@@ -44,3 +78,4 @@ done
4478
4579kill -CONT $child
4680exit 0
81+