RPi & Nightstand
Introduction
A not uncommon thing to do these days is to have a device on your nightstand. It serves the purpose of a clock, alarm, MP3 player. I like the idea of a dedicated device instead of my phone/tablet. A Raspberry Pi, with this kit, is great for this project.
So far, configuring the RPi is pretty straightforward. I've used Raspberry Pi OS (64-Bit) and the tweaks are explained below.
I decided to build a simple webui and launch it in full-screen Chromium. This is because:
Various MP3 distros are not hackable & do not have clocks/alarms.
Regular Linux apps in RaspPiOS are not friendly for small screens nor touch.
So the webui is in its infancy. Once it does a clock, alarm, and MP3, I'll make the repo public.
Setup Rasp OS
So, back to just getting a basic system up and running, since I'm just playing around. BTW, not everything is all command line. So while I did most through SSH, you will need a keyboard & mouse.
Install Raspberry Pi OS. I did not choose Lite because it's a pain to figure out all the packages needed for a DE and for touch. Regular Raspberry Pi OS has all the already set up!
Do the usual stuff, and if you want sudo git clone https://github.com/rmdegennaro/scripts.git (probably need to sudo apt install git as well).
Flip the video because of how the touchscreen is installed into the case by adding the two lines to /boot/config.txt. Some added info: 1 = 90 degrees, 2 = 180 degrees, 3 = 270 degrees. Also, note that both are oddly needed (at least when I did it on 6/23/2022).
lcd_rotate=2 (this does the initial boot screen)
display_hdmi_rotate=2 (this does the screen after "Welcome to Debian")
You might need to go to Menu -> Preferences -> Screen Resolution & "invert" it. It depends on the touch screen you get.
Uninstall any unnecessary stuff. Adjust the below to your liking:
sudo apt purge geany thonny (these are dev packages that I think are unnecessary)
sudo apt purge cups* hplip* printer-driver* (these are printing packages that I don't think are necessary)
sudo apt auto-remove && sudo apt clean (clean up stragglers)
Create a user that logs in automatically. This user should not be a privileged user, and the configuration tools built into Raspberry Pi OS do not make easy.
sudo adduser <username> (Create a generic user; be careful with the command, it's not useradd!)
sudo usermod -aG sudo <username> (This allows them to do "sudo" stuff because that's the only way to set autologin)
su <username> (This opens a shell running as that new user.)
sudo raspi-config (This user should not always have this privilege.)
System Options -> Boot / Auto Login -> Desktop Autologin (This actually sets the autologin.)
exit (Just log the new user out of the shell).
sudo gpasswd -d <newuser> sudo (Now take away "sudo" stuff from the new user.)
Reboot & hopefully it worked!
Now autostart Chromium to a webserver by editing /etc/xdg/lxsession/LXDE-pi/autostart and add the following at the end:
@xset s off
@xset -dpms
@xset s noblank
@chromium-browser --start-fullscreen http://somewebserver.com/
NOTE: Change http://somewebserver.com/ to what you want. I installed apache2 and pointed the RPi at itself. Essentially that is http://localhost/ . So far I'm getting good performance.
NOTE: This is for all users, you can add the ~/.config/lxsession/LXDE-pi/autostart file for the user you created above.
At some point, regular screen blanking got disabled with full-screen Chrome. This can be "turned off" by installing the xscreensaver package. But since the use case for the RPi is on a nightstand, let's configure it a bit too.
sudo apt install xscreensaver (command to install the package)
To configure xscreensaver, exit full-screen chrome and to the preferences. I choose "Blank Screen Only" under "Mode".
NOTE: It would be cool if I could just edit the ~/.xscreensaver file, but it is very extensive and the developer essentially says no manual edits.
NOTE: When the screen turns off, there is a slight glow. If you look around for turning off the "backlight", it just turns off the display. It does not turn off the glow. This may be different for your touch screen.
{I need to do an install script} Once all that is done, git clone and install this project.
{not sure what's next}
(optional, but STRONGLY suggested) shutdown, remove SD card/USB drive & image it for backup!
Other Ideas
simple system for touchscreen & web app (either running on Pi or another system).
(in progress) using full Raspberry Pi OS & web app on local machine with apache
need whole DE? proof of concept with Raspberry Pi OS Lite, but add X11 & touch screen?
maybe use Ubuntu Core?
can web app run from local with no webserver?
try Plasma-mobile; postmarketOS looks good to try out; might need to build apps.
Other ToDo
Get rid of FlipClock.js (MIT license) dependency.
What About Kodi.tv?
I had thought the easiest thing to start using would be Kodi.tv. I could write some Kodi plug-ins like a clock. I'm not going in that direction for the following reasons:
I don't like Kodi's playlist feature for audio.
I don't like Kodi's gestures for touch.
Kodi doesn't have any skins that I feel are touch-friendly enough.
Kodi ignores the screen rotation.
The last one is perhaps the most important. It could be a Raspberry Pi OS maintainer issue or a Kodi maintainer issue. Usually, open source is so cool in so many ways. In this case, from the research I've done, neither project seems to want to fix the issue. :-( Sadly, I'm not stepping up either.