diff --git a/README.md b/README.md new file mode 100644 index 0000000..ca1c621 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +# Generate Linux desktop launchers for Progressive Web Apps + +**pwa-launcher** is a command-line program to generate Linux desktop app +launchers for Progressive Web Apps, using either Firefox or Chromium. + +This tool will create a launcher in your standard Linux applications list +that uses the favicon of the website in question and will launch the site as +a web app in Firefox or Chrome. + +**Note:** at time of writing, Firefox stable (77.0.1) has some support for +"site specific browsers" but it is not enabled by default. Enable it in +`about:config` by setting **browser.ssb.enabled = true**. + +## Dependencies + +The `icotool` command will be used to extract PNG images from a website's +favicon.ico file. Install it with e.g. `apt install icoutils`. If the command +is not available, only PNG images such as apple-touch-icons can be used +automatically by this program. (.ico files with image/png mime types will +be used as PNG images directly, too). + +## Usage + +```bash +pwa-launcher [options] + +# Examples +pwa-launcher https://www.reddit.com/ +pwa-launcher -title Reddit -browser google-chrome https://www.reddit.com/ +pwa-launcher -browser firefox-esr https://www.youtube.com/ +``` + +Options (all are optional unless they can't be auto-detected): + +* **-title** + + Set the app name for the launcher. The default will parse the `` + of the website if available. + +* **-browser** + + Specify what web browser to use. Use either the absolute path + (/usr/bin/firefox) or just the command name. The default will search + for a suitable browser, preferring Firefox > Chromium > Google Chrome. + +* **-icon** + + Specify an icon image to use with the launcher. Can be a local icon on + disk or at an HTTP URL (will be downloaded). The default will search + the website's HTML to find icons and also check some well-known URIs + for Apple Touch icons. The largest available icon size is used by + default. + +* **-exec** + + Manually provide the exec line for launching the web browser. By + default a suitable value is used based on whether you're using Firefox + or Chromium. Providing this option will override the `-browser` option, + as the `-browser` is really only used to determine the command name + and type of browser you're using. + + Example values include: `firefox --ssb %s` or `chromium --app=%s` + + Use the placeholder "%s" where the URL would go in the command. + +* **<url>** + + The web URL that the launcher will open. If a title and icon are needed, + the program will parse the HTML at this URL and search for titles + and icons. + +## Launchers and Icons + +Desktop launchers are placed in the user's home directory at +`~/.local/share/applications/` and their app icons (PNG images) are +placed in `~/.config/pwa-launcher` + +File naming convention is like `pwa-$(domain)-$(time).desktop` where the +domain is the base domain of the site (e.g. `www.reddit.com`) and the time +is a Unix timestamp. + +To remove launchers and icons, delete them from the above locations. diff --git a/pkg/browsers.go b/pkg/browsers.go index 0005cbf..9f2792b 100644 --- a/pkg/browsers.go +++ b/pkg/browsers.go @@ -11,6 +11,7 @@ import ( var browsers = []string{ "/usr/bin/firefox", "/usr/bin/chromium", + "/usr/bin/chromium-browser", "/usr/bin/google-chrome", }