Skip to content

Commit c2ed848

Browse files
author
Andreas Poulsen
committed
Update chromium autostart format
1 parent c37f71d commit c2ed848

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

justfile

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ alias fp := fix-permissions
77

88
fix-permissions:
99
fd --type f --exclude .git --exec chmod 755
10+
11+
black:
12+
black .

os2borgerpc_kiosk/os2borgerpc_kiosk/chromium_setup.sh renamed to os2borgerpc_kiosk/os2borgerpc_kiosk/chromium_autostart.sh

+18-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if ! id $USER &>/dev/null; then
1919
fi
2020

2121
# Autologin default user
22-
mkdir -p /etc/systemd/system/[email protected]
22+
mkdir --parents /etc/systemd/system/[email protected]
2323

2424
# Note: The empty ExecStart is not insignificant!
2525
# By default the value is appended, so the empty line changes it to an override
@@ -32,12 +32,21 @@ EOF
3232

3333
# Create script to rotate screen
3434

35-
cat << EOF > /usr/local/bin/rotate_screen.sh
35+
ROTATE_SCREEN_SCRIPT_PATH="/usr/share/os2borgerpc/bin/rotate_screen.sh"
36+
OLD_ROTATE_SCREEN_SCRIPT_PATH="/usr/local/bin/rotate_screen.sh"
37+
38+
# ...remove the rotate script from its previous location
39+
rm --force $OLD_ROTATE_SCREEN_SCRIPT_PATH
40+
41+
cat << EOF > $ROTATE_SCREEN_SCRIPT_PATH
3642
#!/usr/bin/env sh
3743
3844
set -x
3945
40-
sleep $TIME
46+
TIME=\$1
47+
ORIENTATION=\$2
48+
49+
sleep \$TIME
4150
4251
export XAUTHORITY=/home/$USER/.Xauthority
4352
@@ -50,22 +59,22 @@ OTHER_MONITORS=\$(echo "\$ALL_MONITORS" | tail -n +2)
5059
echo "\$OTHER_MONITORS" | xargs -I {} xrandr --output {} --same-as "\$PRIMARY_MONITOR"
5160
5261
# Rotate screen - and if more than one monitor, rotate them all.
53-
echo "\$ALL_MONITORS" | xargs -I {} xrandr --output {} --rotate $ORIENTATION
62+
echo "\$ALL_MONITORS" | xargs -I {} xrandr --output {} --rotate \$ORIENTATION
5463
EOF
5564

56-
chmod +x /usr/local/bin/rotate_screen.sh &
65+
chmod +x $ROTATE_SCREEN_SCRIPT_PATH
5766

5867

5968
# Create a script dedicated to launch chromium, which both xinit or any wm
6069
# launches, to avoid logic duplication, fx. having to update chromium settings
6170
# in multiple files
6271
# If this script's path/name is changed, remember to change it in
6372
# wm_keyboard_install.sh as well
64-
#
65-
# password-store=basic and enable-offline-auto-reload do not exist as policies so we add them as flags.
6673
CHROMIUM_SCRIPT='/usr/share/os2borgerpc/bin/start_chromium.sh'
6774
mkdir --parents "$(dirname "$CHROMIUM_SCRIPT")"
6875

76+
# TODO: Make URL a policy instead ("RestoreOnStarupURLs", see chrome_install.sh)
77+
# password-store=basic and enable-offline-auto-reload do not exist as policies so we add them as flags.
6978
cat << EOF > "$CHROMIUM_SCRIPT"
7079
#!/bin/sh
7180
@@ -94,11 +103,11 @@ xset s off
94103
xset s noblank
95104
xset -dpms
96105
97-
# Dev note: We used to have "sleep 20" here but we removed it.
106+
# Dev note: We used to have "sleep 20" hardcoded here but we removed it.
98107
# Re-add if it causes timing issues. That said such potential issues should be
99108
# solveable simple by raising the sleep parameter to rotate_screen.sh
100109
101-
/usr/local/bin/rotate_screen.sh
110+
$ROTATE_SCREEN_SCRIPT_PATH $TIME $ORIENTATION
102111
103112
# Launch chromium with its non-WM settings
104113
exec $CHROMIUM_SCRIPT nowm

0 commit comments

Comments
 (0)