Initial commit with first version.

This commit is contained in:
Fliegerjohn 2023-12-18 22:19:26 +01:00
commit fea71d4736
Signed by: fliegerjohn
GPG key ID: E2221D5FE4656B6A
2 changed files with 103 additions and 0 deletions

14
README.md Normal file
View file

@ -0,0 +1,14 @@
### Build kinda webapp with Firefox
Firefox [removed](https://bugzilla.mozilla.org/show_bug.cgi?id=1682593) the SSB feature, so we're not able to add a webapp in this way.
I took the script from [here](https://wiki.postmarketos.org/wiki/Firefox) and modified it a little bit.
The ssb part is removed and I added the part below, so we hide the tabs toolbar and navbar.
There is also the option of starting the session in kioskmode, but I wasn't able to copy and paste there. That's why I went this way.
For now you're able to browse trough the internet with one tab. I didn't managed it to block all domains except the given one.
If you got any idea how to do that, let me know!
To add a webapp with launcher on your homescreen run it like this:
```./add-webapp.sh "Hydrogen" "https://hydrogen.datenkastl.de"```
After that you have a new launcher on your homescreen from where you can open the given website inside a new profile.
Have fun!

89
add-webapp.sh Executable file
View file

@ -0,0 +1,89 @@
#!/usr/bin/env bash
# Create firefox profile
set -e
name=$1
url=$2
# Ugly, copy-pasted from SO
simple_name=$(echo "$name" | awk '{print tolower($0)}' | sed 's/ //g')
echo "Creating webapp $name, using $url."
firefox-esr -CreateProfile $simple_name
# Create desktop entry
cat >~/.local/share/applications/$simple_name.desktop <<EOL
[Desktop Entry]
Exec=firefox-esr -P $simple_name $url
Icon=/home/user/.local/share/applications/$simple_name.png
Type=Application
Terminal=false
Name=$name
StartupNotify=true
StartupWMClass=firefox
EOL
# Get icon
wget $url/favicon.ico -O /tmp/favicon.ico
convert /tmp/favicon.ico /tmp/favicon.png
mv /tmp/favicon.png .local/share/applications/$simple_name.png ||
mv /tmp/favicon-0.png .local/share/applications/$simple_name.png
rm /tmp/favicon*.png
# Modify chrome/userChrome.css to hide everyting on top and bottom
profile_dir=$(find ~/.mozilla/firefox/ -maxdepth 1 | grep $simple_name)
mkdir $profile_dir/chrome
cat >$profile_dir/chrome/userChrome.css <<EOL
/* Hide tabs toolbar on top*/
#TabsToolbar {
visibility: collapse !important;
}
/* Hide navbar on top*/
#nav-bar {
/* customize this value. */
--navbar-margin: -30px;
margin-top: var(--navbar-margin);
margin-bottom: 0;
z-index: -100;
transition: all 0.3s ease !important;
opacity: 0;
}
#navigator-toolbox:focus-within > #nav-bar,
#navigator-toolbox:hover > #nav-bar
{
margin-top: 0;
margin-bottom: var(--navbar-margin);
z-index: 100;
opacity: 1;
}
/* Hide tabs toolbar on bottom*/
#TabsToolbar {
visibility: collapse !important;
}
/* Hide navbar on bottom*/
#nav-bar {
/* customize this value. */
--navbar-margin: -30px;
margin-top: 0;
margin-bottom: var(--navbar-margin);
z-index: -100;
transition: all 0.3s ease !important;
opacity: 0;
}
#navigator-toolbox:focus-within > #nav-bar,
#navigator-toolbox:hover > #nav-bar
{
margin-top: var(--navbar-margin);
margin-bottom: 0;
z-index: 100;
opacity: 1;
}
EOL