Initial commit

This commit is contained in:
Paper 2020-03-22 19:01:22 +01:00
commit 2b42b38131
3 changed files with 102 additions and 0 deletions

27
README.md Normal file
View File

@ -0,0 +1,27 @@
# miniice
Create "standalone" apps from websites using firefox.
Inspired by Peppermint OS's ice.
# install
```
$ make install
```
add ~/.local/share/miniice/bin to your $PATH
# usage
create a new webapp
```
miniice add <name> <url>
```
Delete existing webapp
```
miniice del <name>
```
list all configured webapps
```
miniice list
```

11
makefile Normal file
View File

@ -0,0 +1,11 @@
PREFIX = /usr/local
all:
install:
install -D -m 755 miniice $(DESTDIR)$(PREFIX)/bin/miniice
uninstall:
rm $(DESTDIR)$(PREFIX)/bin/miniice
.PHONY: all install uninstall

64
miniice Executable file
View File

@ -0,0 +1,64 @@
#!/bin/sh -e
# inspired by peppermint OS's ice - user.js and userChrome.css is taken from them:
# https://github.com/peppermintos/ice
prefix="$HOME/.local/share/miniice"
mkdir -p "$prefix/bin"
mkdir -p "$prefix/firefox"
help() {
echo 'usage: miniice [list|add <name> <url>|del <name>|-h|--help|help]
miniice list - list all SSBs configured
miniice add <name> <url> - create a new SSB
miniice del <name> - delete existing SSB
miniice [help|-h|--help] - show this help'
}
add() {
# TODO: check if exists
name="$1"
url="$2"
mkdir -p "$prefix/firefox/$name"
echo 'user_pref("browser.cache.disk.enable", false);user_pref("browser.cache.disk.capacity", 0);user_pref("browser.cache.disk.filesystem_reported", 1);user_pref("browser.cache.disk.smart_size.enabled", false);user_pref("browser.cache.disk.smart_size.first_run", false);user_pref("browser.cache.disk.smart_size.use_old_max", false);user_pref("browser.ctrlTab.previews", true);user_pref("browser.tabs.warnOnClose", false);user_pref("plugin.state.flash", 2);user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);' > "$prefix"/firefox/"$name"/user.js
mkdir -p "$prefix/firefox/$name/chrome"
echo '#nav-bar, #identity-box, #tabbrowser-tabs, #TabsToolbar { visibility: collapse !important; }' > "$prefix"/firefox/"$name"/chrome/userChrome.css
echo "firefox --class SSB-$name --profile $prefix/firefox/$name --no-remote $url" > "$prefix/bin/$name"
chmod 755 "$prefix/bin/$name"
}
del() {
# TODO: check if exists
name="$1"
rm -rf "$prefix/firefox/$name"
rm "$prefix/bin/$name"
}
list() {
cd "$prefix"/bin
for f in *; do
[ "$f" = '*' ] && continue
echo "$f"
done
}
if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "help" ]; then
help
exit 0
elif [ "$1" = add ]; then
shift
! [ $# = 2 ] && help && exit 1
add "$1" "$2"
elif [ "$1" = del ]; then
shift
! [ $# = 1 ] && help && exit 1
del "$1"
elif [ "$1" = list ]; then
shift
! [ $# = 0 ] && help && exit 1
list
else
help
exit 1
fi