diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2017-02-06 00:33:49 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2017-02-06 00:33:49 -0300 |
commit | b59db208b79a19ff4f566335d0d8bb1b3dae69c8 (patch) | |
tree | f5623219793fb021506b1e2a0769173c812863d1 /libre/min/min.js | |
parent | ab0531d59e13e7d170ddaa0039c84b246162c574 (diff) | |
download | abslibre-b59db208b79a19ff4f566335d0d8bb1b3dae69c8.tar.gz abslibre-b59db208b79a19ff4f566335d0d8bb1b3dae69c8.tar.bz2 abslibre-b59db208b79a19ff4f566335d0d8bb1b3dae69c8.zip |
min: add new package to [libre] - Privacy issue #1204 -> https://labs.parabola.nu/issues/1204
Diffstat (limited to 'libre/min/min.js')
-rw-r--r-- | libre/min/min.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libre/min/min.js b/libre/min/min.js new file mode 100644 index 000000000..e3bfeba0f --- /dev/null +++ b/libre/min/min.js @@ -0,0 +1,29 @@ +#!/usr/bin/electron + +const name = 'min'; + +const {app} = require('electron'); +const fs = require('fs'); +const path = require('path'); + +// Change command name. +const fd = fs.openSync('/proc/self/comm', fs.constants.O_WRONLY); +fs.writeSync(fd, name); +fs.closeSync(fd); + +// Remove first command line argument (/usr/bin/electron). +process.argv.splice(0, 1); + +// Set application paths. +const appPath = path.join(path.dirname(__dirname), 'lib', name); +const packageJson = require(path.join(appPath, 'package.json')); +const productName = packageJson.productName; +app.setAppPath(appPath); +app.setDesktopName(name + '.desktop'); +app.setName(productName); +app.setPath('userCache', path.join(app.getPath('cache'), productName)); +app.setPath('userData', path.join(app.getPath('appData'), productName)); +app.setVersion(packageJson.version); + +// Run the application. +require('module')._load(appPath, module, true); |