forked from ugotapi/pagepi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1-pagepi.sh
123 lines (95 loc) · 4.66 KB
/
1-pagepi.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
ifconfig
# Ask the user for info
read -p 'What is the website url you want to display? ' webvar
echo Site you want to display on TV? $webvar
while true; do
read -p "Is the above info correct? " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
echo continuing
#enable ssh server
sudo systemctl enable ssh
sudo systemctl start ssh
sudo apt update
sudo apt upgrade -y
cd ~
#re-enable X display server vs new Wayland. Becuse old tools for X dont work in Wayland.
sudo sed -i "s/greeter-session=pi-greeter-wayfire/greeter-session=pi-greeter/" /etc/lightdm/lightdm.conf
sudo sed -i "s/user-session=LXDE-pi-wayfire/user-session=LXDE-pi-x/" /etc/lightdm/lightdm.conf
sudo sed -i "s/autologin-session=LXDE-pi-wayfire/autologin-session=LXDE-pi-x/" /etc/lightdm/lightdm.conf
#autohide taskbar by copying panel file to user profile and editing it disable updater notifications
sudo cp -a -f /etc/xdg/lxpanel /home/$USER/.config/
sudo awk 'NR==FNR{if (/ type=updater/) for (i=-1;i<=3;i++) del[NR+i]; next} !(FNR in del)' /etc/xdg/lxpanel/LXDE-pi/panels/panel /etc/xdg/lxpanel/LXDE-pi/panels/panel | sudo dd of=/home/$USER/.config/lxpanel/LXDE-pi/panels/panel
# edit file to hide panel
sudo sed -i "s/autohide=.*/autohide=1/" /home/$USER/.config/lxpanel/LXDE-pi/panels/panel
sudo sed -i "s/heightwhenhidden=.*/heightwhenhidden=0/" /home/$USER/.config/lxpanel/LXDE-pi/panels/panel
sudo sed -i '/ point_at_menu=0/a notifications=0' /home/$USER/.config/lxpanel/LXDE-pi/panels/panel
#hide mouse when no movement and allow programmed refresh with cron script
sudo apt install xdotool unclutter -y
# no window border
sudo mkdir ~/.config/openbox
sudo cp /etc/xdg/openbox/rc.xml ~/.config/openbox/rc.xml
sudo sed -i "s/<keepBorder>yes/<keepBorder>no/" ~/.config/openbox/rc.xml
# no decorations
sudo sed -i "s#</applications>#<application class=\"*\"> <decor>no</decor> </application> </applications>#" ~/.config/openbox/rc.xml
#no blank screen
mkdir /home/$USER/.config/lxsession
mkdir /home/$USER/.config/lxsession/LXDE-pi
cp /etc/xdg/lxsession/LXDE-pi/autostart /home/$USER/.config/lxsession/LXDE-pi/
sudo echo '@xset s noblank' >> /home/$USER/.config/lxsession/LXDE-pi/autostart
sudo echo '@xset -dpms' >> /home/$USER/.config/lxsession/LXDE-pi/autostart
sudo echo '@xset s off' >> /home/$USER/.config/lxsession/LXDE-pi/autostart
sudo echo "sh /home/$USER/myscript.sh" >> /home/$USER/.config/lxsession/LXDE-pi/autostart
#change setting to openbox
sudo cp /etc/xdg/lxsession/LXDE-pi/desktop.conf /home/$USER/.config/lxsession/LXDE-pi/desktop.conf
sudo sed -i "s/window_manager=.*/window_manager=openbox/" /home/$USER/.config/lxsession/LXDE-pi/desktop.conf
#create the file that starts Chromium a displays a web page. myscript.sh is what you edit to get a different web page on the TV.
cat > /home/$USER/myscript.sh << EOL
#!/bin/sh
# what this script does: start chromium
chromium-browser --new-window --window-position=0,0 --window-size=3840,2160 --incognito --user-data-dir=/home/$USER/.config/chromium2 --enable-features=OverlayScrollbar,OverlayScrollbarFlashAfterAnyScrollUpdate,OverlayScrollbarFlashWhenMouseEnter --app=$webvar &
EOL
sudo chmod +x /home/$USER/myscript.sh
## black blackground and disable notifications
mkdir /home/$USER/.config/pcmanfm
mkdir /home/$USER/.config/pcmanfm/LXDE-pi
cat > /home/$USER/.config/pcmanfm/LXDE-pi/desktop-items-0.conf << EOL
[*]
desktop_bg=#000000
desktop_shadow=#000000
desktop_fg=#E8E8E8
desktop_font=PibotoLt 12
wallpaper=/usr/share/rpd-wallpaper/clouds.jpg
wallpaper_mode=color
show_documents=0
show_trash=0
show_mounts=0
EOL
# refresh screen local via keyboard emulation. If you want to have multiple separate windows of chromium running on your tv and need refreshing, you would add additional copies of line 50, 51, 52 to the refresh.sh script. Then edit the mysript.sh
# and add chromium lines for location of those windows you need.
echo '#!/bin/sh' > /home/$USER/refresh.sh
echo '# blah blah' >> /home/$USER/refresh.sh
# line 50
echo 'WID=$(xdotool search --onlyvisible --class chromium|head -1)' >> /home/$USER/refresh.sh
# line 51
echo 'xdotool windowactivate ${WID}' >> /home/$USER/refresh.sh
# line 52
echo 'xdotool key ctrl+F5' >> /home/$USER/refresh.sh
# make executable
sudo chmod +x /home/$USER/refresh.sh
cd ~
# refresh every 15 minutes
#write out current crontab
crontab -l > mycron
#echo new cron into cron file
echo "*/15 * * * * DISPLAY=:0 /home/$USER/refresh.sh" >> mycron
#install new cron file
crontab mycron
rm mycron
read -p "After this reboot your website should display. To edit the website displayed edit: the file here /home/$USER/myscript.sh Hit Enter key to continue"
sudo reboot