-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsommelierrc
More file actions
45 lines (37 loc) · 1.4 KB
/
sommelierrc
File metadata and controls
45 lines (37 loc) · 1.4 KB
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
#!/usr/bin/env bash
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Startup hook for the sommelier service. You should not need to modify this
# file as customizations may be placed in ~/.sommelierrc instead.
#
# For documentation, see:
# https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/vm_tools/sommelier/
set -eu
set -o pipefail
# Set Xft.dpi. Some applications (e.g. Chrome) use this to detect HiDPI.
if { command -v xdpyinfo && command -v xrdb; } > /dev/null; then
DPI="$(xdpyinfo | sed -n -E "/dots per inch/{s|^.* ([0-9]+)x.*$|\\1|g; p}")"
if [[ -n "${SOMMELIER_APPLY_DPI_FIX:-}" ]]; then
# the DPI returned by xdpyinfo might be incorrect, workaround below fixes the value:
# 1.25x of the DPI reported by xdpyinfo = the DPI reported by xdpyinfo in Crostini
echo -e "\e[1;34m""Applying DPI fix...""\e[0m"
DPI="$(( ${DPI} / 4 * 5 ))"
fi
xrdb -merge <<< "Xft.dpi: ${DPI}"
# Set cursor theme
if [[ ! "$(xrdb -get Xcursor.theme)" ]]; then
xrdb -merge <<< 'Xcursor.theme: Adwaita'
fi
fi
if command -v xsetroot > /dev/null; then
xsetroot -cursor_name left_ptr
fi
# allow privileged apps to access X display (allow root user)
if command -v xhost > /dev/null; then
xhost +si:localuser:root
fi
if [ -f ~/.sommelierrc ]; then
source ~/.sommelierrc
fi
exit 0