diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2a5f665 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +PREFIX?=${HOME}/.local +BINDIR?=$(PREFIX)/bin +SITEDIR?=$(BINDIR)/nativefier +SHAREDIR?=$(PREFIX)/share/mknative +ICONDIR?=$(SHAREDIR)/icons + +RM?=rm -f + +help: + @echo 'Makefile for mknative ' + @echo ' ' + @echo ' install ' + @echo ' uninstall ' + +install: + mkdir -m755 -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(SITEDIR) $(DESTDIR)$(ICONDIR) + install -m755 mknative $(DESTDIR)$(BINDIR)/mknative + install -m755 runnative $(DESTDIR)$(BINDIR)/runnative + install -m755 icons/* $(DESTDIR)$(ICONDIR) + +uninstall: + $(RM) $(DESTDIR)$(BINDIR)/mknative + $(RM) $(DESTDIR)$(BINDIR)/runnative + +.DEFAULT_GOAL := help diff --git a/icons/git.with.parts.png b/icons/git.with.parts.png new file mode 100644 index 0000000..5ad5af2 Binary files /dev/null and b/icons/git.with.parts.png differ diff --git a/mknative b/mknative new file mode 100755 index 0000000..5e9b09e --- /dev/null +++ b/mknative @@ -0,0 +1,59 @@ +#!/bin/bash +# Make a 'native app' wrapper using nativefier for a site. + +usage() { echo "Usage: $0 -u -s https://example.com -n NativeExample"; exit 1; } + +while getopts "us:n:" option; do + case ${option} in + u) + uninstall=1 + echo "Uninstalling ..." + ;; + s) + url=${OPTARG} + echo "URL: $url" + ;; + n) + name=${OPTARG} + echo "Name: $name" + ;; + *) + usage + ;; + esac +done + +if [ -n "${uninstall}" ]; then + if [ -z "${name}" ]; then + usage + fi + + rm ~/.local/share/applications/$name.desktop + rm -r ~/.local/bin/nativefier/${name}-*/ + + exit 0 +fi + +if [ -z "${name}" ] || [ -z "${url}" ]; then + usage +fi + +docker run --privileged -ti \ + -v $HOME/.local/bin/nativefier:/target/ \ + -v $HOME/.local/share/mknative/icons:/src \ + jiahaog/nativefier:latest \ + --name $name \ + --icon /src/$name.png \ + -p linux \ + -a x64 \ + $url \ + /target/ + +echo " +[Desktop Entry] +Type=Application +Exec=$HOME/.local/bin/runnative $name +Icon=${HOME}/.local/share/mknative/icons/${name}.png +Terminal=false +Name=$name +" > ~/.local/share/applications/$name.desktop diff --git a/runnative b/runnative new file mode 100755 index 0000000..a52698c --- /dev/null +++ b/runnative @@ -0,0 +1,5 @@ +#!/bin/bash + +site=$1 + +$HOME/.local/bin/nativefier/$site-linux-x64/$site &