Skip to content

Commit 977d0c0

Browse files
authored
Remove Wayland restriction, work around Chromium text-indent bug (#112)
* Now works with Bookworm/Wayland autostart and kiosk mode. * Work-around for a Chromium browser bug that broke scrolling of the weather alert marquee.
1 parent fdebc43 commit 977d0c0

14 files changed

Lines changed: 130 additions & 56 deletions

.idea/aw-clock.iml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 3.6.0
2+
3+
* Now works with Bookworm/Wayland autostart.
4+
* Work-around for a Chromium browser bug that broke scrolling of the weather alert marquee.
5+
16
## 3.5.4
27

38
* Fix Bookworm installation issues.

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ When viewing the sky map feature you can choose to see a multicolor sky, shaded
3232

3333
The following instructions are primarily aimed at turning a Raspberry Pi into a *dedicated* Astronomy/Weather Clock, meaning serving as a clock will be the Raspberry Pi’s primary, if not sole, function. The Pi will boot up directly into full-screen kiosk mode running the Astronomy/Weather Clock software.
3434

35-
> Note: If you're running Raspbian "Bookworm" or later, ensure that you are using the X11 desktop option (set via raspi-config). Wayfire and Wayland are not yet supported.
36-
37-
> Also note: Temperature/humidity sensors are not yet supported with the Raspberry Pi 5 due to a major change in the way the 5 handles GPIO.
35+
> Note: Temperature/humidity sensors are not yet supported with the Raspberry Pi 5 due to a major change in the way the 5 handles GPIO.
3836
3937
The first step, if you want GPS support, is to install a GPS device according to the manufacturer’s instructions. This device must provide a PPS (Pulse Per Second) signal for precise time keeping (something USB dongles do not provide), and must be configured to work with `ntpd`. I recommend the [Adafruit Ultimate GPS HAT](https://www.adafruit.com/product/2324), not only because it works well, but because it’s the only GPS hardware I’ve tested. I’ve also provided [notes on the Adafruit GPS HAT installation](#adafruit-gps-hat-installation-notes) at the end of this document.
4038

build.js

Lines changed: 36 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as path from 'path';
1010
import { convertPinToGpio } from './server/src/rpi-pin-conversions';
1111
import { ErrorMode, getSudoUser, getUserHome, monitorProcess, monitorProcessLines, sleep, spawn } from './server/src/process-util';
1212
import { promisify } from 'util';
13+
import { existsSync } from 'fs';
1314

1415
const enoughRam = os.totalmem() / 0x40000000 > 1.5;
1516

@@ -107,6 +108,7 @@ const fontDst = '/usr/local/share/fonts/';
107108
let chromium = 'chromium';
108109
let autostartDst = '.config/lxsession/LXDE';
109110
const lxdePiCheck = '.config/lxpanel/LXDE-pi';
111+
const wayfireIni = '.config/wayfire.ini';
110112
let nodePath = process.env.PATH;
111113

112114
if (process.platform === 'linux') {
@@ -994,6 +996,7 @@ async function doServerBuild(): Promise<void> {
994996

995997
async function doServiceDeployment(): Promise<void> {
996998
let autostartDir = path.join(userHome, autostartDst);
999+
const wayfireIniPath = path.join(userHome, wayfireIni);
9971000
let morePi_ish = false;
9981001

9991002
if (!autostartDir.endsWith('-pi')) {
@@ -1011,7 +1014,8 @@ async function doServiceDeployment(): Promise<void> {
10111014
await monitorProcess(spawn('chmod', ['+x', serviceDstFull], { shell: true }), spin, ErrorMode.ANY_ERROR);
10121015

10131016
const settingsText =
1014-
`# If you edit AWC_PORT below, be sure to update\n# ${userHome}/${autostartDst}/autostart accordingly.\n` +
1017+
`# If you edit AWC_PORT below, be sure to update\n# ${userHome}/${autostartDst}/autostart` +
1018+
(existsSync(wayfireIniPath) ? ` and\n# ${wayfireIniPath}` : '') + ' accordingly.\n' +
10151019
Object.keys(settings).sort().map(key => key + '=' + settings[key]).join('\n') + '\n';
10161020

10171021
fs.writeFileSync(settingsPath, settingsText);
@@ -1022,7 +1026,7 @@ async function doServiceDeployment(): Promise<void> {
10221026
spin, ErrorMode.ANY_ERROR);
10231027

10241028
if (doKiosk)
1025-
launchChromium = launchChromium.replace(/\s+/, ' --kiosk --autoplay-policy=no-user-gesture-required ');
1029+
launchChromium = launchChromium.replace(/\s+/, ' --start-fullscreen --start-maximized --autoplay-policy=no-user-gesture-required ');
10261030

10271031
const autostartPath = autostartDir + '/autostart';
10281032
const autostartLine1 = autostartDir + '/autostart_extra.sh';
@@ -1070,6 +1074,35 @@ async function doServiceDeployment(): Promise<void> {
10701074
if (update)
10711075
fs.writeFileSync(autostartPath, lines.join('\n') + '\n');
10721076

1077+
// Extra autostart setup for Wayfire
1078+
if (existsSync(wayfireIniPath)) {
1079+
try {
1080+
lines = asLines(fs.readFileSync(wayfireIniPath).toString()).filter(line => !!line.trimEnd());
1081+
1082+
let autoIndex = lines.findIndex(l => l.startsWith('[autostart]'));
1083+
1084+
if (autoIndex < 0) {
1085+
lines.push('');
1086+
lines.push('[autostart]');
1087+
autoIndex = lines.length;
1088+
}
1089+
else
1090+
while (lines[++autoIndex] && !/^clock[12] = /.test(lines[autoIndex])) {}
1091+
1092+
// Prevent duplicate entries
1093+
lines = lines.filter((l, i) => i < autoIndex || !/^clock[12] = /.test(l));
1094+
1095+
lines.splice(autoIndex, 0,
1096+
'clock1 = ' + autostartLine1,
1097+
'clock2 = ' + autostartLine2.substring(1));
1098+
fs.writeFileSync(wayfireIniPath, lines.join('\n') + '\n');
1099+
}
1100+
catch (e) {
1101+
console.error(chalk.redBright('Error: failed to update .config/wayfire.ini to autostart AW-Clock'));
1102+
console.error(chalk.redBright(' ' + e.message));
1103+
}
1104+
}
1105+
10731106
await monitorProcess(spawn('chown', 0, [sudoUser, autostartDir + '/autostart*'],
10741107
{ shell: true }), spin, ErrorMode.ANY_ERROR);
10751108
await monitorProcess(spawn('chmod', uid, ['+x', autostartDir + '/autostart*'],

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock",
3-
"version": "3.5.4",
3+
"version": "3.6.0",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {

sass/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sass/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock-sass",
3-
"version": "3.5.4",
3+
"version": "3.6.0",
44
"description": "SASS builder for aw-clock",
55
"keywords": [
66
"sass"

0 commit comments

Comments
 (0)